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

Improve conversion of resource attributes to/from prometheus #2381

Merged
merged 10 commits into from
Mar 5, 2022

Conversation

dashpole
Copy link
Contributor

@dashpole dashpole commented Feb 24, 2022

Fixes #1782
Related: open-telemetry/opentelemetry-collector-contrib#7081

Changes

Job and Instance <-> Resources Attributes

(Discussion in open-telemetry/opentelemetry-collector-contrib#7081)

Job

Current:job prom label -> job resource attribute -> job prom label.
New: job prom label -> service.name resource attribute -> job prom label.

This will improve the OTLP receiver (and others) -> Prometheus remote write exporter path, since service.name is more likely to be present than job on metrics not originating from prometheus receivers.

Instance

Current:instance prom label -> instance resource attribute -> instance prom label.
New: instance prom label -> service.instance.id resource attributes -> instance prom label.

This will improve the OTLP receiver (and others) -> Prometheus remote write exporter path, since service.instance.id are more likely to be present than instance on metrics not originating from prometheus receivers.

This will also improve the Prometheus receiver -> OTLP (and other) exporter path, since net.host.name +net.host.port align better with semantic conventions than host.name + port or instance. As discussed in the linked issue, http metric conventions are the best fit for these attributes.

Other Resource Attributes <-> target_info

OpenMetrics explicitly defines a way for exporters which discover their own resource information to send metadata with a batch of Prometheus metrics: the target_info metric. This PR describes how this metric SHOULD be used, although it doesn't mandate its use.

cc @Aneurysm9 @jmacd @jsuereth @bogdandrutu @djaglowski

specification/metrics/datamodel.md Outdated Show resolved Hide resolved
specification/metrics/datamodel.md Outdated Show resolved Hide resolved
specification/metrics/datamodel.md Outdated Show resolved Hide resolved
specification/metrics/datamodel.md Outdated Show resolved Hide resolved
specification/metrics/datamodel.md Outdated Show resolved Hide resolved
specification/metrics/datamodel.md Show resolved Hide resolved
specification/metrics/datamodel.md Outdated Show resolved Hide resolved
specification/metrics/datamodel.md Outdated Show resolved Hide resolved
specification/metrics/datamodel.md Outdated Show resolved Hide resolved
carlosalberto pushed a commit to carlosalberto/opentelemetry-specification that referenced this pull request Oct 31, 2024
…lemetry#2381)

* update resource attributes used by prometheus, and round-trip other resource attributes

* address feedbck

* address feedbck

* map target_info to resource, and use service.instance.id for instance

* formatting

* be clear on metric family vs metric point

* Update specification/metrics/datamodel.md

Co-authored-by: Anthony Mirabella <[email protected]>

* change deliniator to /

* fix formatting

Co-authored-by: Anthony Mirabella <[email protected]>
Co-authored-by: Bogdan Drutu <[email protected]>
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.

How do I know which resource attributes are important enough to identify a Prometheus Metrics Stream?
7 participants