-
Notifications
You must be signed in to change notification settings - Fork 976
Add OpenMetrics guidance #1154
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
SergeyKanzhelev
merged 6 commits into
open-telemetry:master
from
justinfoote:openmetrics_guidance
Nov 17, 2020
Merged
Add OpenMetrics guidance #1154
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d4fdae8
Add OpenMetrics interop guidelines
justinfoote 1810c12
Add Prometheus Receiver guidelines; reference collector design
justinfoote be2674a
Add OpenMetrics guidelines to changelog
justinfoote 180ea11
Merge branch 'master' into openmetrics_guidance
justinfoote faab727
Add work in progress note to OpenMetrics guidance
justinfoote e9d83f2
Merge branch 'master' into openmetrics_guidance
SergeyKanzhelev 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
51 changes: 51 additions & 0 deletions
51
specification/metrics/semantic_conventions/openmetrics-guidelines.md
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,51 @@ | ||
| # Guidance for Interoperating with OpenMetrics | ||
|
|
||
| **Note:** This document is work in progress and will be updated as the | ||
| OpenMetrics specification further develops. | ||
|
|
||
| ## Overview | ||
|
|
||
| OpenTelemetry will need to interoperate with systems using the OpenMetrics or | ||
| Prometheus exposition format in two ways: | ||
|
|
||
| * OpenTelemetry may need to accept and propagate metrics expressed in | ||
| the OpenMetrics exposition format, and export them to downstream systems | ||
| (including OpenTelemetry Collector(s), zPages, vendor backends, etc...) | ||
| * OpenTelemetry may need to expose OpenTelemetry generated metrics in the | ||
| OpenMetrics exposition format. | ||
|
|
||
| ### OpenMetrics to OpenTelemetry | ||
|
|
||
| The OpenTelemetry collector implements a Prometheus receiver, which reads | ||
| metrics in the OpenMetrics exposition format. For more information, refer to the | ||
| [Prometheus Receiver Design Document](https://github.com/open-telemetry/opentelemetry-collector/blob/master/receiver/prometheusreceiver/DESIGN.md). | ||
|
|
||
| ### OpenTelemetry to OpenMetrics | ||
|
|
||
| #### Name and Label Keys | ||
|
|
||
| Exposting OpenTelemetry metrics in the OpenMetrics format is primarily | ||
| problematic for metric and label naming; the OpenMetrics exposition format | ||
| expressly forbits some characters that are allowed in OpenTelemetry. | ||
|
|
||
| When converting OpenTelemetry metric events to the OpenMetrics exposition | ||
| format, the name field and all label keys MUST be sanitized by replacing | ||
| every character that is not a letter or a digit with an underscore. | ||
|
|
||
| Example pseudocode: | ||
|
|
||
| ```ruby | ||
| def sanitize(name) | ||
| return name.sub(/\W/, '_') | ||
| ``` | ||
|
|
||
| See also [Metric names and labels](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels) | ||
| in the Prometheus data model documentation. | ||
|
|
||
| OpenMetrics does not allow metric names to begin with a digit. OpenTelemetry's | ||
| [instrument naming requirements](../api.md#instrument-naming-requirements) also | ||
| require that the first character of a metric instrument is non-numeric. | ||
|
|
||
| If a metric event is generated in OpenTelemetry that does not conform to this | ||
| specification, the name of the resulting OpenMetrics metric MAY be prepended | ||
| with an underscore. | ||
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.