opentelemetry-java
opentelemetry-java copied to clipboard
Prometheus exemplar spec compliance
Here's what the spec has to say about exemplars in the prometheus exporter:
Exemplars on OpenTelemetry Histograms and Monotonic Sums 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.
Currently PrometheusHttpServer
does not include exemplars on monotonic sums.
Also, PrometheusHttpServer
does not include filtered attributes from the exemplar.
We should update to be compliant with the spec.