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

Prometheus compatibility: use target_info metric instead of "target" info MF #2701

Merged
merged 2 commits into from
Aug 4, 2022

Conversation

dashpole
Copy link
Contributor

Background

There was some confusion around the use of "target" info MetricFamily vs target_info Metric, which even caused me to incorrectly implement the feature in the collector.

In OpenMetrics, MetricFamily refers to the group of multiple metric datapoints which share the same name. For example, a histogram MetricFamily named scrape_duration_seconds contains Metrics named scrape_duration_seconds_sum and scrape_duration_seconds_count, etc. The suffixes appended to the Metric(s) within a MetricFamily depend on the metric type. For info-typed metrics, the suffix is always _info. Thus, the target info-typed MetricFamily has Metric(s) named target_info:

# TYPE target info
target_info{service_name="my-service",service_instance_id="123456"} 1

In Prometheus (not OpenMetrics), "info" is a convention, rather than a type, and are thus represented with a gauge, which has no type suffix. Thus, in prometheus, both the MetricFamily and the Metric(s) are named target_info.

# TYPE target_info gauge
target_info{service_name="my-service",service_instance_id="123456"} 1

Changes

Since the common portion between OM and Prom is the metric name, rather than the metric family, update references in the spec for "target" info MetricFamily to target_info metric.

cc @jmacd

…metric in the info-typed target metric family
@dashpole dashpole requested review from a team July 28, 2022 15:27
@jmacd jmacd merged commit be6591f into open-telemetry:main Aug 4, 2022
carlosalberto pushed a commit to carlosalberto/opentelemetry-specification that referenced this pull request Oct 31, 2024
…metric in the info-typed target metric family (open-telemetry#2701)

Co-authored-by: Joshua MacDonald <[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.

4 participants