API Error And Latency Monitor: implementation to decision
Treat the prompt as an implementation brief. The useful artifact is not copied code alone, but a reviewed event contract that produces a trustworthy answer.
- 1
Select the boundary
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
This page is the implementation brief
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
What a complete instrumentation pass leaves behind
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
Prompts, bodies, credentials, signatures, and private content were checked for redaction.
Event schema starting points
Event contracts for this workflow
Review the row grain, emit boundary, required types, privacy classes, example payload, and validation checklist before adapting a query or snippet to production.
Related product capability
Continue this workflow in Alerts
Promote the reviewed reliability query into an owned threshold and response workflow.
Related SQL recipes
Answer the next question with SQL
Run the query against the structured fields from this workflow, inspect the example result, and turn a useful answer into a dashboard or 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 meaningful 5xx error rate?
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