Prompt
How do I track API response time and uptime?
Latest observation
Oct 24, 2026
OpenAI APIWeb search: off
To track API response time and uptime, you typically combine health checks, synthetic monitoring, and metrics/logging.
1) Track response time
Measure how long API requests take end-to-end.
Common approaches
- Application metrics: instrument your API to record request latency.
- Synthetic probes: send regular test requests from one or more external locations.
- APM tools: use monitoring platforms that automatically collect latency, errors, and traces.
What to record
- Average latency
- Median / p95 / p99 latency
- Latency by endpoint
- Latency by status code (2xx, 4xx, 5xx)
- Latency by region if user location matters
Example metric
api_request_duration_seconds- Track with percentiles:
- p50: typical request
- p95: slow requests affecting users
- p99: worst-case tail latency
2) Track uptime
Uptime means whether your API is available and responding successfully.
Common approaches
- Health check endpoint: e.g.
/healthor/ready - Ping checks: monitor from outside your system every 1 minute
- HTTP success rate: count successful responses vs failures
What counts as “up”
Usually:
- Returns a successful HTTP response
- Responds within an acceptable timeout
- For deeper checks, can reach dependencies like DB/cache if required
Example uptime calculation
If your API was checked every minute and 3 checks failed in a day:
- Total checks: 1,440
- Success checks: 1,437
- Uptime:
1437 / 1440 = 99.79%
3) Use alerts
Set alerts for:
- High latency: e.g. p95 > 500 ms for 5 minutes
- Error rate: e.g. 5xx > 1%
- Downtime: health check fails for 2–3 consecutive checks
4) Tools you can use
Hosted monitoring
- Datadog
- New Relic
- Grafana Cloud
- Pingdom
- UptimeRobot
- StatusCake
Open-source
- Prometheus + Grafana
- Grafana Loki for logs
- OpenTelemetry for tracing/metrics
- Blackbox Exporter for uptime checks
5) Practical setup
A simple, effective setup:
- Add
/healthendpoint - Export request latency metrics from the app
- Run external uptime checks every 1 minute
- Build a dashboard for:
- p50/p95 latency
- 5xx rate
- uptime %
- Configure alerts for latency, errors, and downtime
6) Minimal example
If you use Prometheus:
- Instrument your API to expose request duration histogram
- Scrape metrics with Prometheus
- Visualize with Grafana
- Use Blackbox Exporter to hit your public API and track availability
If you want, I can also show:
- a Python/Node/Go example
- a Prometheus + Grafana setup
- or a simple uptime monitor script