-
Notifications
You must be signed in to change notification settings - Fork 548
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
Mimir: Add attributed prefix to labels of cost attribution metrics #10509
base: main
Are you sure you want to change the base?
Conversation
💻 Deploy preview available: https://deploy-preview-mimir-10509-zb444pucvq-vp.a.run.app/docs/mimir/latest/ |
CHANGELOG.md
Outdated
@@ -5,6 +5,7 @@ | |||
### Grafana Mimir | |||
|
|||
* [FEATURE] Ingester/Distributor: Add support for exporting cost attribution metrics (`cortex_ingester_attributed_active_series`, `cortex_distributor_received_attributed_samples_total`, and `cortex_discarded_attributed_samples_total`) with labels specified by customers to a custom Prometheus registry. This feature enables more flexible billing data tracking. #10269 | |||
* [CHANGE] Ingester/Distributor: Prefix cost attribution metric labels with `attributed_` to prevent collisions with system cluster and namespace labels. #10509 |
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 is not needed because this new feature isn't included in any release yet.
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.
addressed here 97a5d77
pkg/costattribution/manager.go
Outdated
@@ -21,6 +21,7 @@ const ( | |||
defaultTrackerName = "cost-attribution" | |||
missingValue = "__missing__" | |||
overflowValue = "__overflow__" | |||
usagePrefix = "attributed" |
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.
Nit, but I would expect the prefix to be attributed_
.
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.
addressed in 97a5d77
func addLabelsPrefix(labels []string) []string { | ||
out := make([]string, 0, len(labels)) | ||
for _, l := range labels { | ||
out = append(out, strings.Join([]string{usagePrefix, l}, "")) |
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 should be just:
out = append(out, strings.Join([]string{usagePrefix, l}, "")) | |
out = append(out, usagePrefix + l) |
@@ -21,6 +21,7 @@ const ( | |||
defaultTrackerName = "cost-attribution" | |||
missingValue = "__missing__" | |||
overflowValue = "__overflow__" | |||
usagePrefix = "attributed_" |
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 not sure why is this called "usagePrefix", but I know naming is hard.
Maybe it could be exportedAttributedLabelPrefix
?
What this PR does
Which issue(s) this PR fixes or relates to
Users can set cost attribution labels for cluster and namespace, which may conflict with existing metrics that include a cluster label. To prevent this, cost attribution labels are prefixed, and the prefix can be removed later in the pipeline using recording rules.
Similar approach is implemented in Loki.
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.