Skip to content
Telemetry
Event tracking template

API error and latency monitor

Watch request volume, status codes, route latency, failed endpoints, and customer-impacting API incidents.

Reviewed by the Telemetry product team on . We checked the event names, suggested fields, questions to query, and data to exclude. Who reviews this page

Questions you can answer
  • Which routes are slowest by p95 latency?
  • Which customers are affected by elevated errors?
  • Where did traffic drop or spike?
How to test this template

Set up API error and latency monitor and check the results

Use the prompt to add events, then check the stored fields and query results. Review the event definitions before relying on the numbers.

  1. 1

    Choose when to log

    Instrument the point where api_request_started becomes final.

  2. 2

    Create the contract

    Start with api_request_started, api_request_completed, api_request_failed and keep every field typed, bounded, and privacy-reviewed.

  3. 3

    Run a fixture

    Exercise known success, failure, retry, and empty-result cases before relying on aggregate results.

  4. 4

    Answer the question

    Which routes are slowest by p95 latency?

Template versus use case

Use this template to add events

Copy this template when the measurement goal is already clear. Use the matching use-case guide to review event boundaries, success definitions, and the decisions the resulting SQL should support.

Read API reliability monitoring

Template

Paste this into your coding agent

Replace YOUR_API_KEY, run the flow locally, then verify the generated events and dashboards.

api-error-monitor

API error and latency monitor

text
Add Telemetry to API request handling.

Use /skill.md and this Telemetry API key: YOUR_API_KEY

Log each important API request with:
route_template, method, status_code, status, latency_ms, user_id, team_id, request_size_bytes, response_size_bytes, error_type, and feature.

Create charts for request volume, error rate, p50 latency, p95 latency, and top failing endpoints. Add alerts for 5xx spikes, slow p95 latency, and traffic drops.

Do not log request bodies, cookies, auth headers, secrets, or raw user content.

Events to capture

api_request_startedapi_request_completedapi_request_failedapi_rate_limitedapi_timeout

Verification checklist

Check the events, queries, and dashboard

Events

Synthetic events reach the intended table with stable names and field types.

Queries

The first SQL queries return plausible rows with an explicit time window.

Views

A dashboard uses the real fields and includes enough context to explain a change.

Safety

You checked that events exclude prompts, bodies, credentials, signatures, and private content.

Example event schemas

Check what each event records, when to send it, and which field types it needs. Review the example payload and privacy checklist before using it in production.

Use these queries in Telemetry

Learn about Alerts

Add a threshold and recipients to your reliability query to get alerts.

Related SQL recipes

More SQL recipes

Run the query using this workflow's event fields and check the example result. Save the result to a dashboard or set up an alert.

Browse all recipes
API reliabilityBeginner

Calculate API request throughput by route

Which API routes are processing the most requests per minute?

Open recipe
API reliabilityIntermediate

Measure API 429 rate-limit recovery

Do requests that receive HTTP 429 recover successfully after retrying?

Open recipe
InfrastructureAdvanced

Calculate incident detection and recovery time

How long does each service take to detect and recover from incidents?

Open recipe
API reliabilityBeginner

Calculate API error rate by route

Which API routes have the highest 5xx error rate with at least 20 requests?

Open recipe
API reliabilityIntermediate

Calculate p50, p95, and p99 API latency

Which endpoints have the worst tail latency?

Open recipe
API reliabilityBeginner

Calculate API timeout rate by route

Which API routes time out often enough to affect users?

Open recipe
API reliabilityIntermediate

Compare dependency p95 latency

Which downstream dependencies have the worst tail latency and failure rate?

Open recipe
API reliabilityIntermediate

Measure API availability against an SLO

Did each service meet its daily availability objective?

Open recipe
API reliabilityIntermediate

Calculate API error-budget burn rate

How quickly is the API consuming its 99.9% availability budget?

Open recipe
API reliabilityBeginner

Rank error fingerprints by customer impact

Which error groups affect the most customer accounts?

Open recipe
API reliabilityBeginner

Compare feature rollout error rate

Is the feature-flag rollout less reliable than its control cohort?

Open recipe
API reliabilityIntermediate

Measure incident customer impact by plan

How many accounts were affected by the incident in each plan?

Open recipe

More templates