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

Fix PrometheusNaming.sanitizeMetricName() methods #975

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

mimaison
Copy link
Contributor

Fixes #974

Signed-off-by: Mickael Maison <mickael.maison@gmail.com>
@mimaison
Copy link
Contributor Author

The CI failure seems to be caused by a flaky test: SlidingWindowTest.testMultiRotate().

I've run the prometheus-metrics-core tests locally a dozen of times and this test has never failed for me. However HistogramTest.testExemplarsClassicHistogram() seems a bit flaky too and failed a few times.

@dhoard dhoard merged commit 72b79d4 into prometheus:main Sep 9, 2024
2 checks passed
@dhoard
Copy link
Collaborator

dhoard commented Sep 9, 2024

@mimaison Thanks for the PR!

@mimaison mimaison deleted the issue-974 branch September 9, 2024 13:27
jonatan-ivanov added a commit to micrometer-metrics/micrometer that referenced this pull request Nov 7, 2024
The Prometheus Java Client used to let users to use colons (":")
in the metric names. Apparently, this should have not been allowed.

See the docs: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels
"Metric names may contain ASCII letters, digits, underscores,
and colons. It must match the regex [a-zA-Z_:][a-zA-Z0-9_:]*.
Note: The colons are reserved for user defined recording rules.
They should not be used by exporters or direct instrumentation."

So even if metric names can contain colons (":"),
exporters (like the Prometheus Java Client or Micrometer)
should not use it. The Prometheus Java Client replaces colons (":")
to underscores ("_) starting from 1.3.3.

See prometheus/client_java#974
See prometheus/client_java#975
jonatan-ivanov added a commit to micrometer-metrics/micrometer that referenced this pull request Nov 7, 2024
The Prometheus Java Client used to let users to use colons (":")
in the metric names. Apparently, this should have not been allowed.

See the docs: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels
"Metric names may contain ASCII letters, digits, underscores,
and colons. It must match the regex [a-zA-Z_:][a-zA-Z0-9_:]*.
Note: The colons are reserved for user defined recording rules.
They should not be used by exporters or direct instrumentation."

So even if metric names can contain colons (":"),
exporters (like the Prometheus Java Client or Micrometer)
should not use it. The Prometheus Java Client replaces colons (":")
to underscores ("_") starting from 1.3.3.

See prometheus/client_java#974
See prometheus/client_java#975
jonatan-ivanov added a commit to micrometer-metrics/micrometer that referenced this pull request Nov 7, 2024
The Prometheus Java Client used to let users to use colons (":")
in the metric names. Apparently, this should have not been allowed.

See the docs: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels
"Metric names may contain ASCII letters, digits, underscores,
and colons. It must match the regex [a-zA-Z_:][a-zA-Z0-9_:]*.
Note: The colons are reserved for user defined recording rules.
They should not be used by exporters or direct instrumentation."

So even if metric names can contain colons (":"),
exporters (like the Prometheus Java Client or Micrometer)
should not use it. The Prometheus Java Client replaces colons (":")
to underscores ("_") starting from 1.3.3.

See prometheus/client_java#974
See prometheus/client_java#975
See #5649
jonatan-ivanov added a commit to micrometer-metrics/micrometer that referenced this pull request Nov 7, 2024
The Prometheus Java Client used to let users to use colons (":")
in the metric names. Apparently, this should have not been allowed.

See the docs: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels
"Metric names may contain ASCII letters, digits, underscores,
and colons. It must match the regex [a-zA-Z_:][a-zA-Z0-9_:]*.
Note: The colons are reserved for user defined recording rules.
They should not be used by exporters or direct instrumentation."

So even if metric names can contain colons (":"),
exporters (like the Prometheus Java Client or Micrometer)
should not use it. The Prometheus Java Client replaces colons (":")
to underscores ("_") starting from 1.3.3.

See prometheus/client_java#974
See prometheus/client_java#975
See #5649
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistencies between PrometheusNaming.sanitizeMetricName() methods
2 participants