-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add metrics to track requests throttled in QueryThrottler #18740
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
base: main
Are you sure you want to change the base?
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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #18740 +/- ##
=======================================
Coverage ? 69.83%
=======================================
Files ? 1610
Lines ? 215370
Branches ? 0
=======================================
Hits ? 150404
Misses ? 64966
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| attrs := registry.QueryAttributes{ | ||
| WorkloadName: extractWorkloadName(options), | ||
| Priority: extractPriority(options), | ||
| } | ||
| strategyName := tStrategy.GetStrategyName() | ||
| workload := attrs.WorkloadName | ||
| priorityStr := strconv.Itoa(attrs.Priority) |
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.
@stutibiyani do we need the attrs struct?
I wonder if we can just do this:
| attrs := registry.QueryAttributes{ | |
| WorkloadName: extractWorkloadName(options), | |
| Priority: extractPriority(options), | |
| } | |
| strategyName := tStrategy.GetStrategyName() | |
| workload := attrs.WorkloadName | |
| priorityStr := strconv.Itoa(attrs.Priority) | |
| strategyName := tStrategy.GetStrategyName() | |
| workload := extractWorkloadName(options) | |
| priorityStr := strconv.Itoa(extractPriority(options)) |
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.
Hi @timvaillancourt we added the attrs since it is required in specific strategy implementation as well. So we want to avoid that recomputation.
40e30a1 to
bbd6c4d
Compare
|
📝 Documentation updates detected! New suggestion: Document QueryThrottler metrics |
|
@stutibiyani Thank you! Here's a docs PR that you can review and modify: vitessio/website#2031 |
mattlord
left a 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.
LGTM! Just a few minor notes. Please let me know what you think.
Also, please note the docs PR that I linked to. I can help get you set up in the website repo as needed.
Thank you! ❤️
7f9c7df to
a7f5c99
Compare
Hi @mattlord! I have addressed your comments on the PR. Will also update the docs PR in a day or two. |
mattlord
left a 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.
LGTM! Thank you, @stutibiyani ! ❤️
|
@stutibiyani looks like the new unit tests are now failing. We'll have to get that fixed up before merging. Please let me know if I can be of any help. |
9754675 to
a20caf6
Compare
e422d98 to
f7fe95f
Compare
| qt.stats.requestsThrottled.Add([]string{strategyName, workload, priorityStr, decision.MetricName, strconv.FormatFloat(decision.MetricValue, 'f', -1, 64), strconv.FormatBool(tCfg.DryRun)}, 1) | ||
|
|
||
| // If dry-run mode is enabled, log the decision but don't throttle | ||
| if qt.cfg.DryRun { |
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 we have tCfg := qt.cfg above, we should use tCfg. Otherwise, we can just reference qt.cfg everywhere (IMO).
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.
Missed updating this, thank you!
| env: env, | ||
| stats: Stats{ | ||
| requestsTotal: env.Exporter().NewCountersWithMultiLabels(_queryThrottlerAppName+"Requests", "query throttler requests", []string{"Strategy", "Workload", "Priority"}), | ||
| requestsThrottled: env.Exporter().NewCountersWithMultiLabels(_queryThrottlerAppName+"Throttled", "query throttler requests throttled", []string{"Strategy", "Workload", "Priority", "MetricName", "MetricValue", "DryRun"}), |
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.
The cardinality of MetricValue will potentially be very high, right? - If so, it may make sense to use the existing metrics to determine what the value is, instead of emitting it as a tag here
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.
@nickvanw so this metric will only be emitted when a request is throttled. We have also been using this throttler internally and the cardinality has not been that high. But if you still feel strongly I can remove the MetricValue from the labels.
Signed-off-by: Stuti Biyani <[email protected]>
Signed-off-by: Stuti Biyani <[email protected]>
Signed-off-by: Stuti Biyani <[email protected]>
Signed-off-by: Stuti Biyani <[email protected]>
Signed-off-by: Stuti Biyani <[email protected]>
Signed-off-by: Stuti Biyani <[email protected]>
Signed-off-by: Stuti Biyani <[email protected]>
Signed-off-by: Stuti Biyani <[email protected]>
Signed-off-by: Stuti Biyani <[email protected]>
Signed-off-by: Stuti Biyani <[email protected]>
f7fe95f to
71c0429
Compare
Description
This PR adds observability metrics to the QueryThrottler to track throttling behavior with granular visibility into request patterns and throttling decisions.
Key Changes:
Metrics Addition: Introduced two new multi-label counters to track:
Both metrics are labeled by:
Test Plan
Metrics Tracking Tests:
Related Issue(s)
Checklist
Deployment Notes
AI Disclosure