OpenMetrics collector fails on exemplars
See original GitHub issueThe OpenMetrics collector uses Prometheus’ client lib to parse samples (https://github.com/DataDog/integrations-core/blob/3bf453a/datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py#L428). Unlike Prometheus, OpenMetrics has the concept of Exemplars that are causing issues.
Attempts to ingest metrics with exemplars result in:
2021-08-31 14:17:49 UTC | CORE | ERROR | (pkg/collector/runner/runner.go:302 in work) | Error running check openmetrics: [{"message": "Invalid metric name: a_total 1 #", "traceback": "Traceback (most recent call last):
File \"/opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/base/checks/base.py\", line 1006, in run
self.check(instance)
File \"/opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/base/checks/openmetrics/base_check.py\", line 135, in check
self.process(scraper_config)
File \"/opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/base/checks/openmetrics/mixins.py\", line 533, in process
for metric in self.scrape_metrics(scraper_config):
File \"/opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/base/checks/openmetrics/mixins.py\", line 504, in scrape_metrics
for metric in self.parse_metric_family(response, scraper_config):
File \"/opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/base/checks/openmetrics/mixins.py\", line 428, in parse_metric_family
for metric in text_fd_to_metric_families(input_gen):
File \"/opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/base/checks/libs/prometheus.py\", line 86, in text_fd_to_metric_families
yield build_metric(sample[0], documentation, typ, [sample])
File \"/opt/datadog-agent/embedded/lib/python3.8/site-packages/datadog_checks/base/checks/libs/prometheus.py\", line 29, in build_metric
metric = Metric(name, documentation, typ)
File \"/opt/datadog-agent/embedded/lib/python3.8/site-packages/prometheus_client/metrics_core.py\", line 27, in __init__
raise ValueError('Invalid metric name: ' + name)
ValueError: Invalid metric name: a_total 1 #
Here you can find the example of a counter with an exemplar that the current collector is unable to ingest: https://github.com/OpenObservability/OpenMetrics/blob/main/tests/testdata/parsers/counter_exemplars/metrics
The proposed solution is to either update the custom text_fd_to_metric_families
implementation or use the openmetrics specific parser as suggested by the spec.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
[prometheusexporter] / [prometheusremotewriteexporter ...
I do a test with OTel Collector ( receiver is prometheus, exporter is prometheusremotewrite) , but I found the Collector don't support exemplars...
Read more >Using Prometheus Exemplars to jump from metrics to traces in ...
A step-by-step guide to enable correlation between metrics and traces, using Prometheus, Grafana, Tempo, OpenTelemetry, and OpenMetrics.
Read more >Metrics Data Model | OpenTelemetry
The OpenTelemetry collector is designed to accept metrics data in a number of formats, transport data using the OpenTelemetry data model, and then...
Read more >Docker Prometheus and OpenMetrics metrics collection
Collect your exposed Prometheus and OpenMetrics metrics from your application running inside your containers by using the Datadog Agent, ...
Read more >Prometheus Exemplars in Java Spring Boot - LinuxCzar
The returned format was, indeed, OpenMetrics 1.0 but no Exemplars appeared. I built Prometheus 2.30.1 on my laptop and made a quick test ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for the suggestion @mxmCherry , it was indeed missing. Documentation to v2 in #10068
Thanks @coignetp for nice and detailed docs https://github.com/DataDog/integrations-core/pull/10068
@dim this can be closed, confirmed working (v2 check works good + doesn’t fail on exemplars).