Skip to content

Commit f7285e5

Browse files
dashpolejmacd
andauthored
Specify how to handle prometheus exemplar timestamp and attributes (#2376)
* specify how to handle prometheus exemplar timestamp and attributes * formatting and handle exceeding the character limit Co-authored-by: Joshua MacDonald <[email protected]>
1 parent 809030e commit f7285e5

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

specification/metrics/datamodel.md

+20-2
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,13 @@ Prometheus Cumulative metrics do not include the start time of the metric. When
11661166

11671167
#### Exemplars
11681168

1169-
[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.
1169+
[OpenMetrics Exemplars](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#exemplars)
1170+
can be attached to Prometheus Histogram bucket metrics, which SHOULD be
1171+
converted to exemplars on OpenTelemetry histograms. If present, the timestamp
1172+
MUST be added to the OpenTelemetry exemplar. The Trace ID and Span ID SHOULD be
1173+
retrieved from the `trace_id` and `span_id` label keys, respectively. All
1174+
labels not used for the trace and span ids MUST be added to the OpenTelemetry
1175+
exemplar as attributes.
11701176

11711177
#### Resource Attributes
11721178

@@ -1256,7 +1262,19 @@ OpenTelemetry Metric Attributes MUST be converted to [Prometheus labels](https:/
12561262

12571263
#### Exemplars
12581264

1259-
[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.
1265+
[Exemplars](#exemplars) on OpenTelemetry Histograms SHOULD be converted to
1266+
OpenMetrics exemplars. Exemplars on other OpenTelemetry data points MUST be
1267+
dropped. For Prometheus push exporters, multiple exemplars are able to be
1268+
added to each bucket, so all exemplars SHOULD be converted. For Prometheus
1269+
pull endpoints, only a single exemplar is able to be added to each bucket, so
1270+
the largest exemplar from each bucket MUST be used, if attaching exemplars. If
1271+
no exemplars exist on a bucket, the highest exemplar from a lower bucket MUST
1272+
be used, even though it is a duplicate of another bucket's exemplar.
1273+
OpenMetrics Exemplars MUST use the `trace_id` and `span_id` keys for the trace
1274+
and span IDs, respectively. Timestamps MUST be added as timestamps on the
1275+
OpenMetrics exemplar, and `filtered_attributes` MUST be added as labels on the
1276+
OpenMetrics exemplar unless they would exceed the OpenMetrics
1277+
[limit on characters](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#exemplars).
12601278

12611279
#### Resource Attributes
12621280

0 commit comments

Comments
 (0)