-
Notifications
You must be signed in to change notification settings - Fork 890
[Exporter.Prometheus] Add allow-utf-8 escaping #7440
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
Merged
Kielek
merged 35 commits into
open-telemetry:main
from
martincostello:gh-7246-allow-utf-8
Jul 3, 2026
Merged
Changes from 7 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
4883775
[Exporter.Prometheus] Avoid struct copies
martincostello 3cd1eba
[Exporter.Prometheus] Add dots and values escaping
martincostello 977cac7
[Exporter.Prometheus] Fix sorting
martincostello 8549b36
[Exporter.Prometheus] Address feedback
martincostello f42506e
[Exporter.Prometheus] Update test coverage
martincostello 190a68b
[Exporter.Prometheus] Extend tests
martincostello c0844b9
[Exporter.Prometheus] Add allow-utf-8 escaping
martincostello 7ff2f62
[Exporter.Prometheus] Update CHANGELOGs
martincostello d36104e
[Exporter.Prometheus] Extend test coverage
martincostello 51aff69
[Exporter.Prometheus] Add new benchmark
martincostello 0b7bd2b
[Exporter.Prometheus] Reduce allocations
martincostello 7baa8e0
[Exporter.Prometheus] Wrap lines
martincostello 3913d6d
[Exporter.Prometheus] Further reduce allocations
martincostello d434d3b
Merge branch 'main' into gh-7246
martincostello f93ac58
Merge branch 'main' into gh-7246-allow-utf-8
martincostello f79b46b
Merge branch 'main' into gh-7246
martincostello 3a6995a
Merge branch 'main' into gh-7246-allow-utf-8
martincostello dbe44d4
Merge remote-tracking branch 'origin/main' into gh-7246
martincostello d80f412
Merge branch 'gh-7246' into gh-7246-allow-utf-8
martincostello 8c8a028
[Exporter.Prometheus] Fix CHANGELOGs
martincostello e4bf711
[Exporter.Prometheus] Address feedback
martincostello f86a8c0
Merge branch 'main' into gh-7246
martincostello c7bbf26
[Exporter.Prometheus] Fix merge
martincostello 3fb26e8
[Exporter.Prometheus] Address feedback
martincostello de68faf
[Exporter.Prometheus] Fix typo
martincostello 249e431
Merge branch 'gh-7246' into gh-7246-allow-utf-8
martincostello 7c2480e
[Exporter.Prometheus] Fix SA1202
martincostello 7d946c4
Merge branch 'main' into gh-7246-allow-utf-8
martincostello 3c9419f
[Exporter.Prometheus] Fix merge issues
martincostello 5acc088
Merge branch 'main' into gh-7246-allow-utf-8
martincostello 623180b
[Exporter.Prometheus] Address feedback
martincostello 2be4a4a
Merge branch 'main' into gh-7246-allow-utf-8
martincostello eb3a8f0
[Exporter.Prometheus] Address feedback
martincostello 9d8a9f3
[Exporter.Prometheus] Refactor test
martincostello 5bfff05
[Exporter.Prometheus] Add UTF-8 label test
martincostello File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/OpenTelemetry.Exporter.Prometheus.HttpListener/Internal/Shared/EscapingScheme.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| namespace OpenTelemetry.Exporter.Prometheus; | ||
|
|
||
| /// <summary> | ||
| /// The Prometheus UTF-8 name escaping scheme used when rendering metric and label names. | ||
| /// See https://prometheus.io/docs/instrumenting/escaping_schemes/. | ||
| /// </summary> | ||
| internal enum EscapingScheme | ||
| { | ||
| /// <summary> | ||
| /// Discouraged characters are replaced with the <c>_</c> character. This is the | ||
| /// OpenTelemetry default and also covers the legacy (pre-1.0.0) text formats which | ||
| /// have no negotiated escaping scheme. | ||
| /// </summary> | ||
| Underscores = 0, | ||
|
|
||
| /// <summary> | ||
| /// Dots are replaced with <c>_dot_</c> and underscores are doubled, allowing the | ||
| /// original name to be recovered by a Prometheus client. | ||
| /// </summary> | ||
| Dots, | ||
|
|
||
| /// <summary> | ||
| /// Names that are not valid legacy names are prefixed with <c>U__</c> and discouraged | ||
| /// characters are encoded as their hexadecimal Unicode code point. | ||
| /// </summary> | ||
| Values, | ||
|
|
||
| /// <summary> | ||
| /// Names are not escaped and are emitted as UTF-8. Names that are not valid legacy | ||
| /// names are written using the quoted exposition format (the name is moved inside | ||
| /// the label braces as a double-quoted string and non-legacy label names are quoted). | ||
| /// </summary> | ||
| AllowUtf8, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.