-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TT-11913] Add custom analytics plugins configuration to OAS #6829
[TT-11913] Add custom analytics plugins configuration to OAS #6829
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
API Changes --- prev.txt 2025-01-15 08:43:41.338705507 +0000
+++ current.txt 2025-01-15 08:43:36.299641615 +0000
@@ -889,6 +889,7 @@
PostKeyAuth []MiddlewareDefinition `bson:"post_key_auth" json:"post_key_auth"`
AuthCheck MiddlewareDefinition `bson:"auth_check" json:"auth_check"`
Response []MiddlewareDefinition `bson:"response" json:"response"`
+ TrafficLogs []MiddlewareDefinition `bson:"traffic_logs" json:"traffic_logs"`
Driver MiddlewareDriver `bson:"driver" json:"driver"`
IdExtractor MiddlewareIdExtractor `bson:"id_extractor" json:"id_extractor"`
}
@@ -4013,6 +4014,9 @@
// RetentionPeriod holds the configuration for the analytics retention, it contains configuration
// for how long you would like analytics data to last for.
RetentionPeriod *RetentionPeriod `bson:"retentionPeriod" json:"retentionPeriod,omitempty"`
+ // Plugins configures custom plugins to allow for extensive modifications to analytics records
+ // The plugins would be executed in the order of configuration in the list.
+ Plugins CustomPlugins `bson:"plugins,omitempty" json:"plugins,omitempty"`
}
TrafficLogs holds configuration about API log analytics.
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
Quality Gate failedFailed conditions |
User description
TT-11913
PR for TT-11913
This PR adds
Plugins
section toTrafficLogs
and related unit tests. UI and integration tests will be implemented separately.In
api_definitions.go
file, I addedTrafficLogs []MiddlewareDefinition
field but In OAS contract,TrafficLogs
has alsoEnabled
andTagHeaders
fields. Currently, we don't extract those fields to classic API definition. I think we might need to add a new struct forTrafficLogs
toapi_defitions.go
file that covers that fields along with the custom plugins configuration.PR Type
Enhancement, Tests
Description
Added
Plugins
field toTrafficLogs
for custom analytics plugins.Updated
TrafficLogs
struct in OAS to support plugin configurations.Enhanced unit tests to validate
TrafficLogs
with custom plugins.Updated OAS schema to include
plugins
inTrafficLogs
.Changes walkthrough 📝
api_definitions.go
Add `TrafficLogs` field to `MiddlewareSection`
apidef/api_definitions.go
TrafficLogs
field toMiddlewareSection
.middleware.go
Add `Plugins` support to `TrafficLogs` in OAS
apidef/oas/middleware.go
Plugins
field toTrafficLogs
struct.Plugins
inTrafficLogs
.TrafficLogs
to handle custom plugin configurations.x-tyk-api-gateway.json
Update OAS schema to include `plugins` in `TrafficLogs`
apidef/oas/schema/x-tyk-api-gateway.json
plugins
inTrafficLogs
.plugins
as an array of custom plugin configurations.middleware_test.go
Add unit tests for `TrafficLogs` custom plugins
apidef/oas/middleware_test.go
TrafficLogs
with custom plugins.Fill
andExtractTo
methods forTrafficLogs
.TrafficLogs
.