-
Notifications
You must be signed in to change notification settings - Fork 759
client: add pre-throttling demand RU/s metric #10582
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: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,9 @@ const ( | |
| var ( | ||
| // ResourceGroupStatusGauge comments placeholder | ||
| ResourceGroupStatusGauge *prometheus.GaugeVec | ||
| // DemandRUPerSecGauge is the EMA of demanded RU/s per resource group, including | ||
| // requests rejected by the token bucket (pre-throttling demand). | ||
| DemandRUPerSecGauge *prometheus.GaugeVec | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it is throttled, will the demand be recorded?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes — that's exactly the design intent of this metric. Demand is accumulated at request entry ( |
||
| // SuccessfulRequestDuration comments placeholder | ||
| SuccessfulRequestDuration *prometheus.HistogramVec | ||
| // FailedLimitReserveDuration comments placeholder | ||
|
|
@@ -69,6 +72,15 @@ func initMetrics(constLabels prometheus.Labels) { | |
| ConstLabels: constLabels, | ||
| }, []string{resourceGroupNameLabel, newResourceGroupNameLabel}) | ||
|
|
||
| DemandRUPerSecGauge = prometheus.NewGaugeVec( | ||
| prometheus.GaugeOpts{ | ||
| Namespace: namespace, | ||
| Subsystem: "resource_group", | ||
| Name: "demand_ru_per_sec", | ||
| Help: "EMA of demanded RU/s per resource group, including requests rejected by the token bucket (pre-throttling demand).", | ||
| ConstLabels: constLabels, | ||
| }, []string{newResourceGroupNameLabel}) | ||
|
|
||
| SuccessfulRequestDuration = prometheus.NewHistogramVec( | ||
| prometheus.HistogramOpts{ | ||
| Namespace: namespace, | ||
|
|
@@ -162,6 +174,7 @@ func initMetrics(constLabels prometheus.Labels) { | |
| func InitAndRegisterMetrics(constLabels prometheus.Labels) { | ||
| initMetrics(constLabels) | ||
| prometheus.MustRegister(ResourceGroupStatusGauge) | ||
| prometheus.MustRegister(DemandRUPerSecGauge) | ||
| prometheus.MustRegister(SuccessfulRequestDuration) | ||
| prometheus.MustRegister(FailedRequestCounter) | ||
| prometheus.MustRegister(FailedLimitReserveDuration) | ||
|
|
||
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.
Will these metrics being cleaned?
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.
Good catch. On the current master only
ResourceGroupStatusGaugeis cleaned incleanUpResourceGroup, so this new gauge would leak label series the same way most other per-group metrics already do. The leak impact is small in practice (resource groups are typically long-lived, client-side only, bounded per process), but it's still a real leak and not a design decision. I'll addDeleteLabelValuesforDemandRUPerSecGaugein the cleanup path to keep this PR self-consistent. Cleaning up the other pre-existing per-group metrics is out of scope here — I'm tracking that in a separate branch.