-
Notifications
You must be signed in to change notification settings - Fork 2.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
feat: clear_metrics #16550
feat: clear_metrics #16550
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16550 +/- ##
==========================================
+ Coverage 68.75% 68.77% +0.01%
==========================================
Files 1556 1556
Lines 199806 199831 +25
==========================================
+ Hits 137384 137431 +47
+ Misses 62422 62400 -22 ☔ View full report in Codecov by Sentry. |
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.
Thank you, @wlx5575 ! As noted, we'll need to use a different API.
Thanks!
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.
We'll have to do it differently as this package is not and should not be tied to vtgate in any direct way as it's used by all commands/binaries which publish metrics:
❯ git grep go/stats/prometheusbackend | cat
go/cmd/mysqlctl/command/plugin_prometheusbackend.go: "vitess.io/vitess/go/stats/prometheusbackend"
go/cmd/mysqlctld/cli/plugin_prometheusbackend.go: "vitess.io/vitess/go/stats/prometheusbackend"
go/cmd/vtbackup/cli/plugin_prometheusbackend.go: "vitess.io/vitess/go/stats/prometheusbackend"
go/cmd/vtctld/cli/plugin_prometheusbackend.go: "vitess.io/vitess/go/stats/prometheusbackend"
go/cmd/vtgate/cli/plugin_prometheusbackend.go: "vitess.io/vitess/go/stats/prometheusbackend"
go/cmd/vtorc/cli/plugin_prometheusbackend.go: "vitess.io/vitess/go/stats/prometheusbackend"
go/cmd/vttablet/cli/plugin_prometheusbackend.go: "vitess.io/vitess/go/stats/prometheusbackend"
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.
Thank you for your feedback!could you please suggest where it would be more appropriate to place this API? I can make adjustments based on your suggestion.
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.
If you want this to be for vtgate then add it to vtgate. If you want it to be generic then the stats package has a global dynamic registry of stats that could be reset (and either way, this has nothing specifically to do with the prometheus backend).
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.
VTGate:
Lines 378 to 379 in cf8f5d1
vtgateInst.registerDebugHealthHandler() | |
vtgateInst.registerDebugEnvHandler() |
go/vt/vtgate/scatter_conn.go
Outdated
} else { | ||
|
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.
No need for the ELSE and we can remove the whitespace. If statsName is empty we return. So we can simply return after that IF block as well.
|
func ClearMetrics() { | ||
vschemaCounters.ResetAll() | ||
errorCounts.ResetAll() | ||
warnings.ResetAll() | ||
vstreamSkewDelayCount.Reset() | ||
vindexUnknownParams.Reset() | ||
timings.Reset() | ||
rowsReturned.ResetAll() | ||
rowsAffected.ResetAll() | ||
queriesProcessed.ResetAll() | ||
queriesRouted.ResetAll() | ||
queriesProcessedByTable.ResetAll() | ||
queriesRoutedByTable.ResetAll() | ||
vttabletTimings.Reset() | ||
tabletCallErrorCount.ResetAll() | ||
} |
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 will be a problem because 1) this does not include the full list of vtgate stats today 2) when new ones are added in the future it will not be clear (or expected) to have to find this and add the new stat here for the reset.
This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:
If no action is taken within 7 days, this PR will be closed. |
This PR was closed because it has been stale for 7 days with no activity. |
Description
Related Issue(s)
Checklist