prometheusopen-telemetry

Unable to write OTLP data to the Prometheus OTLP write receiver


I have a Prometheus server (v2.49.1) and I want to write OTLP data to it using the new OTLP write receiver feature. According to the Our commitment to OpenTelemetry blog post this feature is available from Prometheus v2.47.0, but when I try to use it, as per the Prometheus docs, it fails with an odd error I don’t understand.

After checking the Prometheus config docs for v2.49, it suggests there isn’t an otlp config block - which contradicts the GitHub docs/guides unless I’ve misunderstood something.

I followed the GitHub guide which led to this error being generated. I added --enable-feature=otlp-write-receiver to my startup command flags, and I added the storasge.tsdb and otlp.resource_attributes config blocks mentioned in the guide to my promtheus.yml config file. Basically followed the guide to the letter. It seems to like the storage.tsdb block, but not the otlp.resource_attributes block.

Error:

caller=main.go:492 level=error msg="Error loading config (--config.file=/opt/prometheus/prometheus.yml)" file=/opt/prometheus/prometheus.yml err="parsing YAML file /opt/prometheus/prometheus.yml: yaml: unmarshal errors:\n line 21: field otlp not found in type config.plain"

Everything so far indicates v2.47.0+ supports the OTLP write receiver.


Solution

  • It seems the doc you mentioned refers to the latest 3.0.0 beta release. This can be confirmed by looking at the Changelog.

    The --web.enable-otlp-receiver command line option has been introduced in 3.0.0-beta1. Before that, including v2.49.1, you should use --enable-feature=otlp-write-receiver option instead.

    The otlp section of the Prometheus configuration has been introduced in v2.55.