Repository navigation
fix(hybridcloud): Stop counting rejected webhooks as successful deliveries - #121606
Merged
Merged
Conversation
…eries
`perform_cell_request` handles a 409 conflict and a 400/401/403/404 by
incrementing `deliver_webhooks.failure` and then returning normally rather than
raising. Control falls back to `deliver_message`, which deletes the payload,
records `delivery_time_ms` and increments `delivery{outcome:ok}` — so a webhook
the cell refused is reported as delivered. The parallel drain does the same, via
`deliver_message_parallel` returning a null error.
Measured over 24h that is 379,521 payloads: 213,606 conflict, 162,729
unauthorized, 2,916 bad_request, 261 not_found and 9 forbidden. About 1.5% of
the 25.6M `outcome:ok` never reached a cell, and their latency is folded into
`delivery_time_ms` — biased low, since a rejection returns faster than a real
delivery. The only trace of them is the `failure` counter, which no dashboard
widget plots.
Both paths now raise `DeliveryDropped`, distinct from the retryable
`DeliveryFailed`, carrying the outcome tag. Callers delete the payload as before
but record `outcome:conflict` or `outcome:dropped_4xx` instead of `ok`, and skip
the delivery-time distribution. Per-reason detail stays on the `failure` metric
rather than being duplicated onto `outcome`.
`deliver_message` now returns whether the payload reached the cell, so the
sequential drain's `delivered` counter stops including discards. The parallel
drain already excluded them.
No behaviour change to what is retried or deleted: a drop is terminal, so
ordering-sensitive providers continue past it exactly as they did when the 4xx
fell through as success.
vaind
force-pushed
the
fix/webhook-dropped-outcomes
branch
from
August 10, 2026 12:11
a7ba690 to
f12606a
Compare
joseph-sentry
approved these changes
Aug 10, 2026
vaind
added a commit
that referenced
this pull request
Aug 10, 2026
### Why The [Hybrid Cloud Webhook Forwarding](https://app.datadoghq.com/dashboard/tqt-8cb-xmj/hybrid-cloud-webhook-forwarding) dashboard has a `provider` template variable, but `deliver_webhooks.{delivery,saved,failure}` carry no such tag — only the `webhookpayload.mailbox.*` gauges do. Verified against Datadog: `sum:...delivery{*} by {provider}` returns zero series. So selecting a provider does not filter those widgets, it **blanks** them, which reads as "no traffic" rather than "this metric cannot answer that question". It also makes per-provider delivery health answerable at all. The 401s and 409s behind `failure` are ~376k/day between them and there is currently no way to see which integration they belong to. ### Where provider comes from From the payload column wherever a row is loaded. Two paths have no row: - **the push trigger** — `maybe_trigger_drain` only receives a mailbox name - **the DoesNotExist race** — the row is already gone Both read the first segment of the mailbox name. Mailboxes are `<provider>:<identifier>`, and it is the *identifier* that later gains bucket and event-type suffixes, so the first segment stays the provider. The column is nullable and rows predating it still drain through, hence the `unknown` fallback — matching what `record_mailbox_depth_metrics` already does. ### Rebased onto #121606 That PR added two new `delivery` outcomes — `conflict` and `dropped_4xx` — for payloads a cell permanently rejects. Both are tagged here too, so every `delivery` emission carries `provider`; otherwise those two would have been the only outcomes to vanish when a provider is selected, which is the exact failure this PR exists to remove. ### Deliberately left untagged Following the cardinality restraint in #121601 ("every tag value costs a series per worker"): - **`send_request` timer** — a timer is seven series, so this would be 7 × cells × providers, for a latency question `delivery_time_ms` already answers. - **`schedule_webhook_delivery.mailbox_count`** — aggregates across every mailbox in a scheduler run, so there is no single provider to attribute it to. ### Cost `delivery` goes to outcome × provider, `failure` to reason × cell × provider. Provider values are bounded by the integration list — Datadog currently sees 10 distinct values on the mailbox gauges.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
perform_cell_requesthandles a 409 conflict and a 400/401/403/404 by incrementingdeliver_webhooks.failureand then returning normally instead of raising. Control falls back todeliver_message, which proceeds straight throughpayload.delete()→_record_delivery_time_metrics()→metrics.incr(outcome="ok"). The parallel drain does the same, sincedeliver_message_parallelreturns a null error and_handle_parallel_delivery_resultreads that as success.So a webhook the cell refused is reported as delivered.
Measured over 24h in production, that is 379,521 payloads:
About 1.5% of the 25.6M
outcome:ok. Their latency is also folded intodelivery_time_ms, biased low because a rejection returns faster than a real delivery. The only trace of them is thefailurecounter, which no dashboard widget plots — which is why this went unnoticed.The change
Both paths now raise
DeliveryDropped, distinct from the retryableDeliveryFailed, carrying the outcome tag. Callers delete the payload exactly as before, but recordoutcome:conflictoroutcome:dropped_4xxinstead ofok, and skip the delivery-time distribution.Per-reason detail stays on
failure{reason:*}rather than being duplicated ontooutcome, keeping that tag low-cardinality.deliver_messagenow returns whether the payload reached the cell, so the sequential drain'sdeliveredcounter stops including discards — the parallel drain already excluded them.Not changed
What gets retried or deleted is identical. A drop is terminal rather than a failure, so ordering-sensitive providers continue past it just as they did when the 4xx fell through as success; there is a regression test for that.
After deploy
outcome:okdrops by ~1.5% and two new series appear on the Delivery Outcomes widget of the Hybrid Cloud Webhook Forwarding dashboard.delivery_time_mspercentiles may tick up slightly as the fast rejections stop being counted.