Telemetry
Webhooks SQL recipe

Measure Webhook Latency and Duplicate Rate

Compare processing latency, duplicate deliveries, and failures by webhook provider and event type.

Intermediatewebhook_deliveriesReviewed 2026-07-27

Question answered

Which webhook sources are slow, duplicated, or unreliable?

Duplicate delivery is normal for at-least-once systems, but duplicate side effects are not. Track the delivery outcome and the idempotency decision separately.

Event contract

Fields the query expects

FieldTypeWhy it exists
timestamp_utcTimestampProcessing completion time.
providerUtf8Webhook provider.
event_typeUtf8Provider event category.
idempotency_outcomeUtf8new_event or duplicate.
statusUtf8success or failed.
latency_msFloat64Processing duration.
DataFusion SQL

Copy the query

sql
SELECT
  provider,
  event_type,
  COUNT(*) AS deliveries,
  SUM(CASE WHEN idempotency_outcome = 'duplicate' THEN 1 ELSE 0 END) AS duplicates,
  SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) AS failures,
  100.0 * SUM(CASE WHEN idempotency_outcome = 'duplicate' THEN 1 ELSE 0 END)
    / NULLIF(COUNT(*), 0) AS duplicate_rate_pct,
  approx_percentile_cont(latency_ms, 0.95) AS p95_latency_ms
FROM webhook_deliveries
WHERE timestamp_utc >= now() - INTERVAL '7 days'
GROUP BY provider, event_type
ORDER BY duplicate_rate_pct DESC, failures DESC;

This recipe is read-only and reviewed against Telemetry's DataFusion query patterns. Sample output is deterministic and synthetic; validate field types, thresholds, and business definitions against your own data.

Query result

Duplicate and failed webhook deliveries

Stripe payment failures have the highest duplicate rate and more terminal failures.

providerevent_typedeliveriesduplicatesfailuresduplicate_rate_pctp95_latency_ms
stripeinvoice.payment_failed4803497.081,180
githubpush2,9404231.43420

Synthetic example output. Run the query against your own event schema and thresholds before using it for operational decisions.

How the SQL works

  1. 1CASE expressions compute duplicate and failure counts from the same delivery population.
  2. 2The duplicate rate is a delivery characteristic; it does not prove duplicate business effects.
  3. 3Tail latency shows whether the handler is approaching a provider timeout or retry boundary.

Edge cases to decide

  • A duplicate may be successfully deduplicated and should not automatically count as failure.
  • Provider retry policies and event volumes differ, so preserve provider and event type.
  • Never store webhook signatures or raw payment payloads in this table.

Recommended dashboard

  • Stacked bars: duplicates and failures by event type
  • Trend: p95 webhook latency
  • Table: recent failed downstream jobs

Alert guidance

Alert on repeated processing failures or duplicate side effects, not expected deduplicated delivery.

Read alert setup

Put the recipe to work

Related instrumentation and guides

Continue the analysis

Run it on real 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.

Get an API key