-
Notifications
You must be signed in to change notification settings - Fork 69
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
Alerting: adapt sum of gauges to use options #584
Conversation
for _, tenantEntry := range d { | ||
if tenantEntry.tenant == "" { | ||
continue | ||
} | ||
|
||
result := singleValueWithLabelsMap{} | ||
tenantEntry.metrics.sumOfSingleValuesWithLabels(metric, labelNames, gaugeValue, result.aggregateFn, false) | ||
tenantEntry.metrics.sumOfSingleValuesWithLabels(metric, opts.labelNames, gaugeValue, result.aggregateFn, opts.skipZeroValueMetrics) |
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.
Could you please add unit test showing that skipping of zero values works?
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.
Added now 👍
|
||
// SendSumOfGaugesPerTenantWithLabels provides metrics with the provided label names on a per-tenant basis. This function assumes that `tenant` is the | ||
// first label on the provided metric Desc | ||
func (d MetricFamiliesPerTenant) SendSumOfGaugesPerTenantWithLabels(out chan<- prometheus.Metric, desc *prometheus.Desc, metric string, labelNames ...string) { |
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.
To avoid breaking clients, can we keep this function and reimplement it using SendSumOfGaugesPerTenant
+ WithLabels
option? (We can mark it as deprecated if we want to get rid of it)
We can then also revert changes in the unit tests, to prove that function still works as before.
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 point, no breaking changes then. Added it now and reverted unit tests also 👍
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. Can you add an enhancement changelog entry?
Co-authored-by: Peter Štibraný <pstibrany@gmail.com>
Added now. Thanks for the review 🙌 |
Thank you. |
To be able to filter 0 value gauges per tenant, we need to adapt the helper as it was done already before for other metrics.
Trying to follow the name convention, but not sure if we should introduce a new function instead. Despite being simple to adapt, it would require changes