Skip to content

Commit 4b70e1b

Browse files
committed
docs(exposition): clarify required Content-type header for scrapes
Signed-off-by: Lukas Juozas Janušaitis <lukas.janusaitis@hostinger.com>
1 parent 9b2c67b commit 4b70e1b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/instrumenting/exposition_formats.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,22 @@ When such features are enabled either by feature flag
167167
appropriate configuration option (`scrape_native_histograms: true`) then
168168
Protobuf will be favored over other exposition formats.
169169

170+
## HTTP Content-Type requirements
171+
172+
Starting with Prometheus 3.0, scrape targets **must** return a valid `Content-Type` header for the metrics endpoint. If the `Content-Type` is missing, unparsable, or not a supported media type, **the scrape will fail**. See changes in [scrape protocols](https://prometheus.io/docs/prometheus/latest/migration/#scrape-protocols) in the migration guide for details.
173+
174+
At minimum, set the `Content-Type` media type to one of:
175+
176+
- `application/openmetrics-text`
177+
- `text/plain`
178+
- `application/vnd.google.protobuf`
179+
180+
Adding parameters such as `version=` (e.g. `text/plain;version=1.0.0`) is **optional**. Prometheus will correctly negotiate the protocol based solely on the media type. For the canonical list of protocols, parameters, and the negotiation rules, see [Scrape protocol content negotiation](./content_negotiation.md).
181+
182+
### Common pitfall
183+
184+
The value of the `Content-Type` header must be a **valid MIME type** — plain tokens like `OpenMetricsText1.0.0` are **not valid** and the scrape will fail. Use the full media type instead, `application/openmetrics-text;version=1.0.0'`. See [Protocol Headers](./content_negotiation.md#protocol-headers) for details.
185+
170186
## Historical versions
171187

172188
For details on historical format versions, see the legacy

0 commit comments

Comments
 (0)