From 0fb5fca994ebe6c08ed5bec04a562b0b05407fb7 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Fri, 25 Feb 2022 14:58:50 +0000 Subject: [PATCH] address feedbck --- specification/metrics/datamodel.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/specification/metrics/datamodel.md b/specification/metrics/datamodel.md index 8b3a5a2ad3f..09367903270 100644 --- a/specification/metrics/datamodel.md +++ b/specification/metrics/datamodel.md @@ -1238,11 +1238,28 @@ OpenTelemetry Metric Attributes MUST be converted to [Prometheus labels](https:/ #### Resource Attributes -In SDK Prometheus (pull) exporters, resource attributes SHOULD be converted to the [`target_info`](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#supporting-target-metadata-in-both-push-based-and-pull-based-systems) metric, or MUST be dropped, and MUST NOT be attached as labels to other metrics. The `target_info` metric MUST info-typed metric whose labels MUST include the resource attributes, and MUST NOT include any other labels. There MUST be at most one `target_info` metric exposed on a Prometheus endpoint. - -In the Collector's Prometheus pull and push (remote-write) exporters, it is possible for metrics from multiple targets to be sent together, so targets must be disambiguated from one another. However, the Prometheus exposition format and [remote-write](https://github.com/Prometheus/Prometheus/blob/main/prompb/remote.proto) formats do not include a notion of resource, and expect metric labels to distinguish scraped targets. By convention, [`job` and `instance`](https://Prometheus.io/docs/concepts/jobs_instances/#jobs-and-instances) labels distinguish targets and are expected to be present on metrics exposed on a Prometheus pull exporter (a ["federated"](https://Prometheus.io/docs/Prometheus/latest/federation/) Prometheus endpoint) or pushed via Prometheus remote-write. In the collector Prometheus exporters, the `service.name` attribute MUST be converted to the `job` metric label, and the `net.host.name` and `net.host.port` attributes, if present, MUST be converted to the `instance` label as `:`. If `job` and `instance` are successfully added, other resource attributes SHOULD be converted to a [`target_info`](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#supporting-target-metadata-in-both-push-based-and-pull-based-systems) metric, or MUST be dropped. The `target_info` metric is an info-typed metric whose labels MUST include the resource attributes, and MUST NOT include any other labels other than `job` and `instance`. There MUST be at most one `target_info` metric exported for each unique combination of `job` and `instance`. - -If info-typed metrics are not yet supported by the language Prometheus client library, a gauge-typed metric named `target_info` with a constant value of 1 MUST be used instead. +In SDK Prometheus (pull) exporters, resource attributes SHOULD be converted to the ["target" info](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#supporting-target-metadata-in-both-push-based-and-pull-based-systems) metric, or MUST be dropped, and MUST NOT be attached as labels to other metrics. The "target" info metric MUST info-typed metric whose labels MUST include the resource attributes, and MUST NOT include any other labels. There MUST be at most one "target" info metric exposed on a Prometheus endpoint. + +In the Collector's Prometheus pull and push (remote-write) exporters, it is +possible for metrics from multiple targets to be sent together, so targets must +be disambiguated from one another. However, the Prometheus exposition format +and [remote-write](https://github.com/Prometheus/Prometheus/blob/main/prompb/remote.proto) +formats do not include a notion of resource, and expect metric labels to +distinguish scraped targets. By convention, [`job` and `instance`](https://Prometheus.io/docs/concepts/jobs_instances/#jobs-and-instances) +labels distinguish targets and are expected to be present on metrics exposed on +a Prometheus pull exporter (a ["federated"](https://Prometheus.io/docs/Prometheus/latest/federation/) +Prometheus endpoint) or pushed via Prometheus remote-write. In the collector +Prometheus exporters, the `service.name` attribute MUST be converted to the +`job` metric label, and the `net.host.name` and `net.host.port` attributes, if +present, MUST be converted to the `instance` label as `:`. +If `job` and `instance` are successfully added, other resource attributes +SHOULD be converted to a ["target" info](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#supporting-target-metadata-in-both-push-based-and-pull-based-systems) +metric, or MUST be dropped. The "target" info metric is an info-typed metric +whose labels MUST include the resource attributes, and MUST NOT include any +other labels other than `job` and `instance`. There MUST be at most one +"target" info metric exported for each unique combination of `job` and `instance`. + +If info-typed metrics are not yet supported by the language Prometheus client library, a gauge-typed metric named "target" info with a constant value of 1 MUST be used instead. To convert OTLP resource attributes to Prometheus labels, string Attribute values are converted directly to labels, and non-string Attribute values MUST be converted to string attributes following the [attribute specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/common.md#attribute).