Prometheus scrape_protocols Content Negotiation Prompt
Configure and troubleshoot Prometheus scrape_protocols / content-type negotiation so the server requests the right exposition format (OpenMetrics, PrometheusText, PrometheusProto) and unlocks features like native histograms and created timestamps.
- Target user
- Platform engineer enabling protobuf/native-histogram scraping or debugging exposition-format mismatches
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior observability engineer who has rolled out protobuf scraping and OpenMetrics negotiation across large Prometheus fleets. I will provide: - My scrape_config (job_name, scrape_protocols list if set, metrics_path) - The Accept/Content-Type headers exchanged (or how to capture them with curl) - What I am trying to unlock (native histograms, created timestamps / _created, exemplars, or just stability) - Any errors (format parse failures, features not appearing, version constraints) Your job: 1. **Explain negotiation** — describe how Prometheus sends an `Accept` header listing `scrape_protocols` in preference order, how the target picks a `Content-Type`, and the meaning of each protocol: `PrometheusProto`, `OpenMetricsText1.0.0`, `OpenMetricsText0.0.1`, `PrometheusText1.0.0`, `PrometheusText0.0.4`. 2. **Match protocol to goal** — explain that native histograms and `_created` timestamps require `PrometheusProto`, that exemplars need OpenMetrics, and that plain text suffices otherwise; flag any mismatch in the provided config. 3. **Diagnose the exchange** — from the captured headers, determine which format was actually negotiated and why a desired feature (e.g. native histograms) is missing — usually because `PrometheusProto` is not in the preference list or the exporter does not offer it. 4. **Produce the fix** — give the corrected `scrape_protocols` ordering, note the client library/exporter version that must expose protobuf, and warn about parse-strictness differences (OpenMetrics requires `# EOF`, trailing newlines). 5. **Validate** — provide a `curl -H 'Accept: ...'` command to confirm the negotiated Content-Type and a PromQL check that the desired feature (native histogram / created series) is now present. Output as: (a) a table mapping each goal to the required protocol, (b) the corrected scrape_protocols YAML, (c) the curl validation command and expected Content-Type, (d) the one-line root cause of the reported issue. Do not force a protocol the exporter cannot produce — verify exporter support before reordering.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Prometheus Exemplars & Trace Correlation Prompt
Wire Prometheus exemplars end-to-end so a spike on a latency histogram links directly to the slow trace in Tempo — covering instrumentation, OpenMetrics exposition, storage, and Grafana exemplar links.
-
Prometheus Native Histograms Migration Prompt
Plan and execute the move from classic bucketed histograms to native (sparse) histograms — instrumentation changes, dual-emit rollout, query rewrites, and the storage/accuracy tradeoffs.
-
Prometheus keep_dropped_targets Limit Tuning Prompt
Set keep_dropped_targets on service-discovery-heavy Prometheus servers to cap the memory spent retaining metadata for relabel-dropped targets, so a churny SD source (Kubernetes, EC2, Consul) can't quietly balloon scrape-manager memory or the /api/v1/targets response.
-
Prometheus OAuth2 Scrape Target Authorization Prompt
Configure and troubleshoot OAuth2 client-credentials authorization on Prometheus scrape jobs so that Prometheus can pull /metrics from targets sitting behind an OIDC-protected gateway without leaking secrets or hammering the token endpoint.
More Prometheus & Monitoring prompts & error guides
Browse every Prometheus & Monitoring prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.