-
Notifications
You must be signed in to change notification settings - Fork 7
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
Make cluster stats names more parseable #10439
Conversation
Issues linked to changelog: |
Visit the preview URL for this PR (updated for commit 0e92ee7): https://gloo-edge--pr10439-cluster-stats-name-k99ozzri.web.app (expires Thu, 12 Dec 2024 16:27:36 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 77c2b86e287749579b7ff9cadb81e099042ef677 |
@@ -0,0 +1,10 @@ | |||
changelog: | |||
- type: BREAKING_CHANGE |
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.
i'm not sure if this should be considered breaking or not, given that it only affects stats names
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.
Well, dashboards and alerts can break, so I'd say it is a breaking change.
@@ -115,7 +114,7 @@ func (u *Updater) UpstreamUpdated(upstream *v1.Upstream) { | |||
|
|||
func (u *Updater) UpstreamAdded(upstream *v1.Upstream) { | |||
// upstream already tracked. ignore. | |||
key := translator.UpstreamToClusterName(upstream.GetMetadata().Ref()) | |||
key := upstream.GetMetadata().Ref().Key() |
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.
this was part of the cleanup i carried over from #10403. in some plugins (etc) we are just using the "cluster name" as key for a map used internally, and i changed those instances to use Ref.Key instead
@@ -156,6 +158,10 @@ func (t *translatorInstance) initializeCluster( | |||
DnsRefreshRate: dnsRefreshRate, | |||
PreconnectPolicy: preconnect, | |||
} | |||
// for kube gateway, use new stats name format | |||
if envutils.IsEnvTruthy(constants.GlooGatewayEnableK8sGwControllerEnv) { | |||
out.AltStatName = UpstreamToClusterStatsName(upstream) |
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.
this is the most important part
@@ -156,6 +158,10 @@ func (t *translatorInstance) initializeCluster( | |||
DnsRefreshRate: dnsRefreshRate, | |||
PreconnectPolicy: preconnect, | |||
} | |||
// for kube gateway, use new stats name format | |||
if envutils.IsEnvTruthy(constants.GlooGatewayEnableK8sGwControllerEnv) { |
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.
I think we do things like this elsewhere but after looking at it I feel like we should be checking these once at the start of a translation rather than checking mid translation where hypothetically some clusters may have this set true and some set false.
Not a problem with this pr more of a thought for our general strategies
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.
yeah we have this check and/or the proxy type check sprinkled throughout the codebase and it's a bit messy..but luckily we should be able to rip them out soon!
this is the only place that i saw that created a Cluster (besides some plugins that create Clusters for other purposes but with well-defined names that don't need this alt stat name)
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.
Verified following the steps mentioned
Co-authored-by: Nathan Fudenberg <nathan.fudenberg@solo.io>
Co-authored-by: Nathan Fudenberg <nathan.fudenberg@solo.io>
Description
When Kubernetes Gateway integration is enabled (i.e. Gloo Gateway is installed with
kubeGateway.enabled=true
), stats names for envoy clusters corresponding to Kubernetes Services or kube-type Upstreams are now in a new more parseable format that allows us to extract info about the Service for metrics.For a Service destination, the cluster stats name will be in the format:
kube-svc_upstreamName_upstreamNs_svcNs_svcName_svcPort
For a Kube Upstream destination, the cluster stats name will be in the format:
kube-upstream_upstreamName_upstreamNs_svcNs_svcName_svcPort
Other destination types will fall back to the current stats format (which is the same as the cluster name):
upstreamName_upstreamNs
Notes:
upstreamName_upstreamNs
).Background
See #10403 for previous attempt and background info.
Testing
Unit tests and a metrics e2e test suite were added.
This can also be tested manually via the following steps:
Checklist: