Documentation 40

Guide · Prometheus

How do I test a Prometheus integration without a real server?

You do not need one. Point your client at a read-only Prometheus replica that already holds the olympus-labs data set, and your code runs unchanged.

01 / The one change

Swap the base URL. Nothing else.

Your client talks to your Prometheus server. Point it at prom.sandboxapis.dev instead: same paths, same JSON, same headers, same status codes. No server to create, no seed script.

Prometheus has no pinned host yet, so this page uses the live host, prom.sandboxapis.dev, which re-rolls daily: assert on what a re-roll keeps, and switch to a pin when one is registered.

02 / Run it now

One request, no account.

request.sh
curl -s "https://prom.sandboxapis.dev/api/v1/label/__name__/values"

It answers with the error ratio of every service in the data set at 00:00 UTC today, one series per service with its job, service, team and tier labels, in Prometheus's own vector JSON.

With a real client, the verified quickstart for prometheus-api-client runs against the live host on every check. It prints the data set's HTTP metric names, then every service that reports a p99 latency at 00:00 UTC today.

python
# pip install prometheus-api-client==0.7.2

from prometheus_api_client import PrometheusConnect

prom = PrometheusConnect(
    url="https://prom.sandboxapis.dev",           # the only line that changes
    headers={"Authorization": "Bearer any-token"},  # any token is accepted
    disable_ssl=False,
)

names = prom.all_metrics()
print("metrics:", ", ".join(sorted(n for n in names if n.startswith("http_"))))

p99 = prom.custom_query('http_request_duration_seconds{quantile="0.99"}')
print("p99 by service:", ", ".join(sorted(r["metric"]["service"] for r in p99)))

What it prints always contains metrics:, http_request_duration_seconds and pipeline-.

03 / Writes

A write gets Prometheus's own error shape.

Every host is read-only. A write answers 403 with Prometheus's own error body, naming what you tried, so your client's existing error handling meets a shape it knows.

403 · application/json
curl -s -X POST "https://prom.sandboxapis.dev/api/v1/admin/tsdb/snapshot" -H 'content-type: application/json' -d '{}'

{"status":"error","errorType":"unavailable","error":"This universe is read-only. See what's covered at https://sandboxapis.dev/coverage. (You tried to take a TSDB snapshot: POST /api/v1/admin/tsdb/snapshot.) Tell us what you needed to write: https://sandboxapis.dev/feedback"}

errorType unavailable is the type Prometheus itself gives a disabled write API; the 403 is this host's, so no client retries the refusal.

04 / Where it stops

Coverage is counted, not claimed.

30 of 40 Prometheus read surfaces are served and verified against Prometheus's own published spec. A call to one that is not covered returns a 404 with an X-SandboxAPIs-Coverage header, never invented data. The row-by-row list is on the Prometheus reference and the coverage page.

Next: read the Prometheus quickstart, or run the four-hop walk to watch one incident cross four services.

What this is not

Read this before you rely on it.

SandboxAPIs is read-only: a write returns the provider's own error unless your key has opted in to scratch writes, and those never reach anybody else. Coverage is bounded, and the manifest that says exactly where it stops is public. The data is a simulated company, not yours and not a copy of anybody's. And it reproduces what each vendor documents and publishes, not the vendor's undocumented behaviour, so keep one test against the real service for that.