-
Notifications
You must be signed in to change notification settings - Fork 2.3k
go/{stats,vt}: publish VReplicationStreamState to prometheus backend #12772
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
mattlord
merged 4 commits into
vitessio:main
from
planetscale:maxeng-vrep-prom-metrics-workflow-status
Mar 31, 2023
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6056e66
go/{stats,vt}: publish VReplicationStreamState to prometheus backend
maxenglander 4beb9ff
changelog/17.0: document prometheus vreplication_stream_state metric
maxenglander e5b245b
go/stats: add tests for StringMapFuncWithMultiLabels
maxenglander 68235e1
pr feedback: remove stray word from comment
maxenglander 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
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
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
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.
I'm curious why we can't use a variation of this:
I don'ts how it's any different. Using the existing code would eliminate a lot of the code in this PR.
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.
Hey @mattlord the difference is that with the current code, it does not change the format of the data exported to expvars. If we follow your recommendation it will change the shape of the expvars JSON.
I wasn't sure if we wanted to make that change, and, if we do that, whether we should treat it as a breaking change.
If you aren't concerned with changing the shape of the JSON, I'm all for your suggestion! Let me know.
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.
Changing JSON should always be non-breaking. But I don't understand what you mean there. Can you share an example?
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.
Here are the local changes I made which is how I understood your suggestion:
Here is what the expvar stats look like with this change:
Which is different from the current JSON shape in
mainand this PR in its current form:Uh oh!
There was an error while loading. Please reload this page.
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.
Ah, I see. A workflow can have N streams and the controller ID is for a given stream. That part makes sense either way. What do we want to do with this metric? Do we want to check the count of ones where the status is e.g.
Stopped? If so, I feel like the first output might be easier for that in e.g. promql or in grafana. Maybe not though?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.
Hey @mattlord the Prometheus output is different from the expvar output format.
The change you recommended above outputs this expvar format:
Both this PR and
mainoutputs this expvar format:Both this PR and the change you recommended will output the same Prometheus output:
So with both this PR and the change you recommended, we'll be able to accomplish what we want with Prometheus just as well. The difference between your recommendation and the PR in its current form is that your recommendation will change the shape of expvars output, whereas this PR maintains its current form.
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 feel like we might be getting hung up on the specifics of the function when I was merely asking why we couldn't use
stats.NewGaugesFuncWithMultiLabels(). It's not clear to me why we can't get the same output you desire and produced in the PR as-is using that existing function. I apologize if I'm being dense and missing something obvious. 🙂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.
@mattlord we totally can use
stats.NewGaugesFuncWithMultiLabels(), and it will do exactly what I want in terms of giving me nice Prometheus output. However, it will change the shape of the existing expvars JSON, which we may be fine with or we may not want, your call. The shape of the expvars JSON will change because that's just the nature ofNewGaugesFuncWithMultiLabels.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.
Thanks! After chatting on Slack we cleared up my confusion.