From 517711c9cb8cb452940b72d2a4ebab713c8b3195 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Tue, 22 Feb 2022 19:24:18 +0000 Subject: [PATCH 1/2] specify how to handle prometheus exemplar timestamp and attributes --- specification/metrics/datamodel.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specification/metrics/datamodel.md b/specification/metrics/datamodel.md index 71bfd3bcbff..2642d7dba6d 100644 --- a/specification/metrics/datamodel.md +++ b/specification/metrics/datamodel.md @@ -1166,7 +1166,7 @@ Prometheus Cumulative metrics do not include the start time of the metric. When #### Exemplars -[Prometheus Exemplars](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#exemplars) can be attached to Prometheus Histogram bucket metrics, which SHOULD be converted to exemplars on OpenTelemetry histograms. The Trace ID and Span ID SHOULD be retrieved from the `trace_id` and `span_id` label keys, respectively. +[OpenMetrics Exemplars](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#exemplars) can be attached to Prometheus Histogram bucket metrics, which SHOULD be converted to exemplars on OpenTelemetry histograms. If present, the timestamp MUST be added to the OpenTelemetry exemplar. The Trace ID and Span ID SHOULD be retrieved from the `trace_id` and `span_id` label keys, respectively. All labels not used for the trace and span ids MUST be added to the OpenTelemetry exemplar as attributes. #### Resource Attributes @@ -1236,7 +1236,7 @@ OpenTelemetry Metric Attributes MUST be converted to [Prometheus labels](https:/ #### Exemplars -[Exemplars](#exemplars) on OpenTelemetry Histograms SHOULD be converted to Prometheus exemplars. Exemplars on other OpenTelemetry data points MUST be dropped. For Prometheus push exporters, multiple exemplars are able to be added to each bucket, so all exemplars SHOULD be converted. For Prometheus pull endpoints, only a single exemplar is able to be added to each bucket, so the largest exemplar from each bucket MUST be used, if attaching exemplars. If no exemplars exist on a bucket, the highest exemplar from a lower bucket MUST be used, even though it is a duplicate of another bucket's exemplar. Prometheus Exemplars MUST use the `trace_id` and `span_id` keys for the trace and span IDs, respectively. +[Exemplars](#exemplars) on OpenTelemetry Histograms SHOULD be converted to OpenMetrics exemplars. Exemplars on other OpenTelemetry data points MUST be dropped. For Prometheus push exporters, multiple exemplars are able to be added to each bucket, so all exemplars SHOULD be converted. For Prometheus pull endpoints, only a single exemplar is able to be added to each bucket, so the largest exemplar from each bucket MUST be used, if attaching exemplars. If no exemplars exist on a bucket, the highest exemplar from a lower bucket MUST be used, even though it is a duplicate of another bucket's exemplar. OpenMetrics Exemplars MUST use the `trace_id` and `span_id` keys for the trace and span IDs, respectively. Timestamps MUST be added as timestmaps on the OpenMetrics exemplar, and `filtered_attributes` must be added as labels on the OpenMetrics exemplar. #### Resource Attributes From da76ab3c2dfa5236226d8b7399a11c0e8971ac0a Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Fri, 4 Mar 2022 20:15:31 +0000 Subject: [PATCH 2/2] formatting and handle exceeding the character limit --- specification/metrics/datamodel.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/specification/metrics/datamodel.md b/specification/metrics/datamodel.md index 2642d7dba6d..2acc772aa8f 100644 --- a/specification/metrics/datamodel.md +++ b/specification/metrics/datamodel.md @@ -1166,7 +1166,13 @@ Prometheus Cumulative metrics do not include the start time of the metric. When #### Exemplars -[OpenMetrics Exemplars](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#exemplars) can be attached to Prometheus Histogram bucket metrics, which SHOULD be converted to exemplars on OpenTelemetry histograms. If present, the timestamp MUST be added to the OpenTelemetry exemplar. The Trace ID and Span ID SHOULD be retrieved from the `trace_id` and `span_id` label keys, respectively. All labels not used for the trace and span ids MUST be added to the OpenTelemetry exemplar as attributes. +[OpenMetrics Exemplars](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#exemplars) +can be attached to Prometheus Histogram bucket metrics, which SHOULD be +converted to exemplars on OpenTelemetry histograms. If present, the timestamp +MUST be added to the OpenTelemetry exemplar. The Trace ID and Span ID SHOULD be +retrieved from the `trace_id` and `span_id` label keys, respectively. All +labels not used for the trace and span ids MUST be added to the OpenTelemetry +exemplar as attributes. #### Resource Attributes @@ -1236,7 +1242,19 @@ OpenTelemetry Metric Attributes MUST be converted to [Prometheus labels](https:/ #### Exemplars -[Exemplars](#exemplars) on OpenTelemetry Histograms SHOULD be converted to OpenMetrics exemplars. Exemplars on other OpenTelemetry data points MUST be dropped. For Prometheus push exporters, multiple exemplars are able to be added to each bucket, so all exemplars SHOULD be converted. For Prometheus pull endpoints, only a single exemplar is able to be added to each bucket, so the largest exemplar from each bucket MUST be used, if attaching exemplars. If no exemplars exist on a bucket, the highest exemplar from a lower bucket MUST be used, even though it is a duplicate of another bucket's exemplar. OpenMetrics Exemplars MUST use the `trace_id` and `span_id` keys for the trace and span IDs, respectively. Timestamps MUST be added as timestmaps on the OpenMetrics exemplar, and `filtered_attributes` must be added as labels on the OpenMetrics exemplar. +[Exemplars](#exemplars) on OpenTelemetry Histograms SHOULD be converted to +OpenMetrics exemplars. Exemplars on other OpenTelemetry data points MUST be +dropped. For Prometheus push exporters, multiple exemplars are able to be +added to each bucket, so all exemplars SHOULD be converted. For Prometheus +pull endpoints, only a single exemplar is able to be added to each bucket, so +the largest exemplar from each bucket MUST be used, if attaching exemplars. If +no exemplars exist on a bucket, the highest exemplar from a lower bucket MUST +be used, even though it is a duplicate of another bucket's exemplar. +OpenMetrics Exemplars MUST use the `trace_id` and `span_id` keys for the trace +and span IDs, respectively. Timestamps MUST be added as timestamps on the +OpenMetrics exemplar, and `filtered_attributes` MUST be added as labels on the +OpenMetrics exemplar unless they would exceed the OpenMetrics +[limit on characters](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#exemplars). #### Resource Attributes