Skip to content
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

[exporter/pkg/translator/prometheus] colon in metric names is being replaced with underscore, even when featureGate is used #14135

Closed
premendrasingh opened this issue Sep 15, 2022 · 3 comments · Fixed by #14158
Labels
enhancement New feature or request needs triage New item requiring triage

Comments

@premendrasingh
Copy link
Contributor

Is your feature request related to a problem? Please describe.

When following metrics are harvested, leading colon is removed and rest of the colons are replaced with underscore.
Using feature flag pkg.translator.prometheus.NormalizeName I was expecting to retain the colons.

Prometheus allows these metrics to be harvested and does not changes the metric name. Check attached screenshot of Prometheus showing metrics with colon.

# HELP foobar with colon
# TYPE foobar counter
:foo::bar_total 7736

foobar-metrics-with-colon

Describe the solution you'd like

Fix behavior of featureGate ** pkg.translator.prometheus.NormalizeName** to allow colons in metric names so that behavior is same as Prometheus client.

Describe alternatives you've considered

Add another featureGate to translator to allow colon in metric names.
pkg.translator.prometheus.AllowColonInMetricNames

Additional context

No response

@premendrasingh premendrasingh added enhancement New feature or request needs triage New item requiring triage labels Sep 15, 2022
@bogdandrutu
Copy link
Member

Where is the name format for Prometheus?

@premendrasingh
Copy link
Contributor Author

Metric name format taken from -

https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels

The metric name specifies the general feature of a system that is measured (e.g. http_requests_total - the total number of HTTP requests received). It may contain ASCII letters and digits, as well as underscores and colons. It must match the regex [a-zA-Z_:][a-zA-Z0-9_:]*

@vjsamuel
Copy link

vjsamuel commented Sep 15, 2022

thank you @bogdandrutu and @Aneurysm9 for comments on slack. Per https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#text-format it is safe to assume that : can be a first character and a character after that.

metricname = metricname-initial-char 0*metricname-char

metricname-char = metricname-initial-char / DIGIT
metricname-initial-char = ALPHA / "_" / ":"

that being said, we can file a fix for the same. @premendrasingh @newly12 can one of you please file a PR to address this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage New item requiring triage
Projects
None yet
3 participants