Background
The metrics endpoint (metrics.py) currently returns the Prometheus exposition body with:
Response(output, mimetype="text/plain; charset=utf-8")
That Content-Type has no version=0.0.4. Prometheus v2 tolerated this (it silently fell back to the 0.0.4 text format), but Prometheus v3 fails the scrape on a missing/unknown format version.
This surfaced during the DecaturMakers monitoring stack's Prometheus v2 → v3 upgrade. As a stopgap, the kiosk scrape job in dm-puppet now sets fallback_scrape_protocol: PrometheusText0.0.4, but the proper fix is to emit a correct Content-Type here so that shim can be removed.
The fix
Use prometheus_client's canonical content type instead of a hand-written one:
from prometheus_client import CONTENT_TYPE_LATEST, generate_latest
# ...
return Response(generate_latest(registry), mimetype=CONTENT_TYPE_LATEST)
CONTENT_TYPE_LATEST is text/plain; version=0.0.4; charset=utf-8.
Done when
References
Background
The metrics endpoint (
metrics.py) currently returns the Prometheus exposition body with:That Content-Type has no
version=0.0.4. Prometheus v2 tolerated this (it silently fell back to the 0.0.4 text format), but Prometheus v3 fails the scrape on a missing/unknown format version.This surfaced during the DecaturMakers monitoring stack's Prometheus v2 → v3 upgrade. As a stopgap, the
kioskscrape job in dm-puppet now setsfallback_scrape_protocol: PrometheusText0.0.4, but the proper fix is to emit a correct Content-Type here so that shim can be removed.The fix
Use
prometheus_client's canonical content type instead of a hand-written one:CONTENT_TYPE_LATESTistext/plain; version=0.0.4; charset=utf-8.Done when
/metricsresponds withContent-Type: text/plain; version=0.0.4; charset=utf-8dmpuppet::internals::kiosk_showtag bumped in dm-puppetfallback_scrape_protocolline is removed from thekioskjob in dm-puppet'sprometheus.yml, and thekiosktarget still scrapes on Prometheus v3References
docs/features/completed/shared-infra_0.10.0_upgrade.md— finding Fix slideshow item creation and editing #2 / follow-up FU-1