Event schema
Fields the query expects
| Field | Type | Why it exists |
|---|---|---|
| timestamp_utc | Timestamp | Dependency call completion time. |
| dependency_name | Utf8 | Stable logical dependency name. |
| operation | Utf8 | Normalized operation or route. |
| status | Utf8 | success, failed, or timeout. |
| latency_ms | Float64 | Dependency duration in milliseconds. |
Copy the query
SELECT
dependency_name,
operation,
COUNT(*) AS calls,
approx_percentile_cont(latency_ms, 0.50) AS p50_ms,
approx_percentile_cont(latency_ms, 0.95) AS p95_ms,
100.0 * SUM(CASE WHEN status <> 'success' THEN 1 ELSE 0 END)
/ NULLIF(COUNT(*), 0) AS failure_rate_pct
FROM dependency_calls
WHERE timestamp_utc >= now() - INTERVAL '24 hours'
GROUP BY dependency_name, operation
HAVING COUNT(*) >= 50
ORDER BY p95_ms DESC
LIMIT 20;This read-only query is planned and executed against an empty typed table with Apache DataFusion 45.2.0. We review the synthetic sample output separately. Check field types, thresholds, and counting rules against your own data. Read the testing methodology.
Query result
Dependency p95 latency
Invoice history has a severe long tail despite an acceptable median.
| dependency_name | operation | calls | p50_ms | p95_ms | failure_rate_pct |
|---|---|---|---|---|---|
| billing_database | invoice_history | 1,840 | 84 | 1,820 | 0.49 |
| search_provider | document_search | 6,220 | 132 | 760 | 1.21 |
| redis | session_lookup | 44,100 | 3 | 12 | 0.02 |
Synthetic example output. Run the query against your own event schema and thresholds before using it for operational decisions.
Reproduce the example
Download the sample data
The JSON bundle includes the event schema with field types, illustrative input rows, exact SQL, expected output, review notes, and engine version. The CSV contains the displayed result.
How the SQL works
- 1Group by dependency and operation to find which calls need investigation.
- 2The gap between p50 and p95 distinguishes consistently slow services from intermittent tail behavior.
- 3Failure rate prevents a fast-failing dependency from appearing healthy.
Edge cases to check
- Avoid raw SQL text, full URLs, or customer identifiers in operation names.
- Parallel dependency calls do not add linearly to request duration.
- If traces already contain this timing, record only the business context needed to connect the outcome.
Recommended dashboard
- Grouped bars: p50_ms and p95_ms by dependency
- Trend: p95 latency and failure rate
- Table: slow dependency calls with route, release, and trace ID
Alert guidance
Alert when a critical dependency exceeds its p95 objective and is affecting a minimum number of calls.
Read alert setupSet up the events this query needs
Related instrumentation and guides
Continue the analysis
Calculate API error rate by route
Rank API routes by 5xx error rate. Exclude routes with fewer than 20 requests so one failure does not dominate the results.
Open recipeCalculate p50, p95, and p99 API latency
Compare median and tail latency by endpoint with DataFusion-compatible percentile SQL.
Open recipeCalculate API error-budget burn rate
Turn hourly request failures into an SLO burn-rate series that shows how quickly the allowed error budget is being consumed.
Open recipeRun it on your events
Create a table, adapt the fields, and save the result
Start free, send structured events, and use the query result as a chart, shared dashboard widget, or alert input.