fix(instr): Fix Kafka state gauge emission#6156
Open
Dav1dde wants to merge 1 commit into
Open
Conversation
jjbayer
reviewed
Jun 30, 2026
|
|
||
| for state in KAFKA_BROKER_STATES { | ||
| relay_statsd::metric!( | ||
| gauge(KafkaGauges::BrokerState) = u64::from(*state == broker.state), |
Member
There was a problem hiding this comment.
What if you made this a counter instead? That would auto-clear in a sense, right?
Member
Author
There was a problem hiding this comment.
Yeah but this becomes really awkward with different aggregation intervals. I think that would be harder to visualize.
Honestly, at this point I am thinking about making this a Sentry Metric instead, as that metric alone will cost us ~200-300$ a month.
Before doing that though, I'd still like to see it in Datadog at least for a few days to get an idea of how things are supposed to look work before turning it off.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Our current metrics backend doesn't actually stop emitting gauges, it continuous to emit gauges with the last seen value (which is good), this breaks the intent of the metric.
This fixes the gauge, but has some caveats (like brokers can't disappear and it doesn't handle unknown states), but I think these are acceptable compromises for this metric, as practically these things never happen and the alternatives are much more complicated.