-
Notifications
You must be signed in to change notification settings - Fork 644
feat: route stat name #6310
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
Merged
Merged
feat: route stat name #6310
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -126,6 +126,24 @@ type BackendTelemetry struct { | |||||||
| // | ||||||||
| // +optional | ||||||||
| Tracing *Tracing `json:"tracing,omitempty"` | ||||||||
| // Metrics defines metrics configuration for the backend or Route. | ||||||||
| // | ||||||||
| // +optional | ||||||||
| Metrics *BackendMetrics `json:"metrics,omitempty"` | ||||||||
| } | ||||||||
|
|
||||||||
| type BackendMetrics struct { | ||||||||
| // RouteStatName defines the value of the Route stat_prefix, determining how the route stats are named. | ||||||||
| // For more details, see envoy docs: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#config-route-v3-route | ||||||||
| // The supported operators for this pattern are: | ||||||||
| // %ROUTE_NAME%: name of Gateway API xRoute resource | ||||||||
| // %ROUTE_NAMESPACE%: namespace of Gateway API xRoute resource | ||||||||
| // %ROUTE_KIND%: kind of Gateway API xRoute resource | ||||||||
| // Example: %ROUTE_KIND%/%ROUTE_NAMESPACE%/%ROUTE_NAME% => httproute/my-ns/my-route | ||||||||
| // Disabled by default. | ||||||||
| // | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apply |
||||||||
| // +optional | ||||||||
| RouteStatName *string `json:"routeStatName,omitempty"` | ||||||||
| } | ||||||||
|
|
||||||||
| // ProtocolUpgradeConfig specifies the configuration for protocol upgrades. | ||||||||
|
|
||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
routes can be attached to multiple gateways/parentRefs which will need to be represented here in case the user doesnt want to aggregate them into 1, and prefers per parent per route metrics
https://gateway-api.sigs.k8s.io/reference/spec/#httproutespec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand your point, I thought this function was supposed to set the stats for the route in the gateways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/envoyproxy/gateway/blob/main/internal/gatewayapi/testdata/httproute-with-multiple-gateways-from-different-ns.out.yaml should help understand how 1 route can attach to multiple gateways
and this introduces two uses cases for metrics granularity that is mentioned in #6310 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to check and validate this somehow?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems I understand what this is about. In the function https://github.com/envoyproxy/gateway/blob/26f9b20a7d5f3060f841787e677c0ed127adc759/internal/gatewayapi/backendtrafficpolicy.go#L664, there is processing for the Gateway, but here we have the IR, and we need to somehow map it to a resource to get the template parameters. We could do this via "resources", but that would be expensive — we'd have to go through all resources for every route, which is O(n²). Maybe we should reconsider the metadata field for all routes?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should have access to it indirectly via the IR listener name
gateway/internal/gatewayapi/helpers.go
Line 377 in 26f9b20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinking out loud, it may help to start off with an API within EnvoyProxy which is easier to build out its not tied to policy translation