-
Notifications
You must be signed in to change notification settings - Fork 225
Description
Describe the bug
The /metrics endpoints uses content-type: application/json
, while Prometheus v3 expects e.g. plain/text
$ curl --head http://10.42.0.72:8000/metrics
HTTP/1.1 200 OK
content-length: 14299
content-type: application/json; charset=utf-8
access-control-allow-headers: *
access-control-allow-methods: *
access-control-allow-origin: *
Prometheus throws:
Error scraping target: received unsupported Content-Type "application/json; charset=utf-8" and no fallback_scrape_protocol specified for target

Seems like Prometheus v2 quietly tolerated this, and v3 is more strict. See https://prometheus.io/docs/prometheus/latest/migration/#scrape-protocols
Workaround
Explicitly set fallbackScrapeProtocol
in a ScrapeConfig for OVMS.
To Reproduce
Steps to reproduce the behavior:
- Run OVMS with
--metrics_enable
and--rest_port=8000
- Setup Prometheus v3 to scrape the /metrics endpoint
Expected behavior
/metrics endpoint uses correct content-type
in header
Configuration
- OVMS version: 4.0.0
- Prometheus v3
My setup was k3s with prometheus-community/kube-prometheus-stack and OVMS installed via Helm
https://github.com/openvinotoolkit/operator/tree/main/helm-charts/ovms