Create an application that exposes a histogram with exemplars, via the prometheus metrics endpoint. The exemplar should include a label with (not limited to), a ., e.g. any of the common otel labels such as url.scheme
Ensure model.NameValidationScheme = model.UTF8Validation is set, promhttp.HandlerOpts.EnableOpenMetrics= true` on the handler.
Configure the collector to scrape prometheus (you can force the OpenMetrics scrape_protocol)
Expected Result
The exemapler is exposed on /metrics, prometheus quotes the dotted label key, e.g.:
The collector should scrape the application, read the exemplar, and pass this on through the pipeline
Actual Result
the scrape fails with an error, debug shows that it fails when reading the quote
Cause
This appears to be a bug in the prometheus scrape code that is not catering for the quoted labels (raised prometheus/prometheus#15259)
Using the standard otel http instrumentation, it's hard to avoid the dotted form of hte quoted labels.
It is possible to just strings.Replace the dots in the opentelemetry-go client library's prometheus exporter, but this is not a general fix for UTF8 label keys.
Component(s)
receiver/prometheus
What happened?
Description
Steps to Reproduce
.
, e.g. any of the common otel labels such asurl.scheme
model.NameValidationScheme = model.UTF8Validation
is set, promhttp.HandlerOpts.EnableOpenMetrics= true` on the handler.Expected Result
/metrics
, prometheus quotes the dotted label key, e.g.:Actual Result
Cause
This appears to be a bug in the prometheus scrape code that is not catering for the quoted labels (raised prometheus/prometheus#15259) Using the standard otel http instrumentation, it's hard to avoid the dotted form of hte quoted labels.
It is possible to just
strings.Replace
the dots in the opentelemetry-go client library's prometheus exporter, but this is not a general fix for UTF8 label keys.Collector version
679374a8656d39b5a38515c7d5fdaf708a999e4c
Environment information
go version go1.23.2 linux/amd64
OpenTelemetry Collector configuration
Log output
Additional context
No response