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
Choose when to log
Instrument the point where api_request_started becomes final.
- 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
Run a fixture
Exercise known success, failure, retry, and empty-result cases before relying on aggregate results.
- 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.
Template
Paste this into your coding agent
Replace YOUR_API_KEY, run the flow locally, then verify the generated events and dashboards.
API error and latency monitor
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
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
Event schemas for this workflow
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.
Calculate API request throughput by route
Which API routes are processing the most requests per minute?
Open recipeMeasure API 429 rate-limit recovery
Do requests that receive HTTP 429 recover successfully after retrying?
Open recipeCalculate incident detection and recovery time
How long does each service take to detect and recover from incidents?
Open recipeCalculate API error rate by route
Which API routes have the highest 5xx error rate with at least 20 requests?
Open recipeCalculate p50, p95, and p99 API latency
Which endpoints have the worst tail latency?
Open recipeCalculate API timeout rate by route
Which API routes time out often enough to affect users?
Open recipeCompare dependency p95 latency
Which downstream dependencies have the worst tail latency and failure rate?
Open recipeMeasure API availability against an SLO
Did each service meet its daily availability objective?
Open recipeCalculate API error-budget burn rate
How quickly is the API consuming its 99.9% availability budget?
Open recipeRank error fingerprints by customer impact
Which error groups affect the most customer accounts?
Open recipeCompare feature rollout error rate
Is the feature-flag rollout less reliable than its control cohort?
Open recipeMeasure incident customer impact by plan
How many accounts were affected by the incident in each plan?
Open recipeMore templates