-
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
Adhere to OTel-Prometheus standard for labels #2004
Conversation
As this is a breaking change to experimental _labels _annotations, we should either feature flag it or announce it visibly in a future changelog. |
/triage accepted |
otelCompatPromLabelName := otelprom.NormalizeLabel(k) | ||
result[otelCompatPromLabelName] = fmt.Sprintf("%v", v) |
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.
It would be great if we could reuse mapToPrometheusLabels here so that we don't duplicate the logic and make sure that both part of the code use the same normalization.
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.
sanitizeLabelName felt a bit more "fitting" to me for this usecase, so I ended up using that here. LMK if you think otherwise and I'll change this accordingly.
Should we perhaps wait for the next major version? Just to make sure we don't break anyone on a minor. |
Since the _labels and _annotations metrics are experimental and not stable, I think it's fine to break them (we should just announce it visibly in the changelog). |
Sounds good 👍 |
74a1a0f
to
680eee0
Compare
680eee0
to
74a1a0f
Compare
74a1a0f
to
d2bb619
Compare
d2bb619
to
8205d35
Compare
Adhere to OTel-Prometheus standard for generated labels in CRS. Ref.: https://github.com/open-telemetry/opentelemetry-specification/blob/8946dfc6a2302f78b0224fcc3f4dfb816a7bb1f4/specification/compatibility/prometheus_and_openmetrics.md?plain=1#L224-L229 Additional info.: OSM has a hardcoded approach for doing this right now: https://github.com/openshift/openshift-state-metrics/blob/master/pkg/collectors/utils.go#L29 Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
8205d35
to
b382da6
Compare
/lgtm thanks for your work on this @rexagod ! /hold for others to review as well |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mrueg, rexagod The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/unhold |
What this PR does / why we need it: Adhere to OTel-Prometheus standard for generated labels in CRS.
How does this change affect the cardinality of KSM: No change.
Additional info.: OSM has a hardcoded approach for doing this right now: https://github.com/openshift/openshift-state-metrics/blob/master/pkg/collectors/utils.go#L29