Repository navigation
feat(hybridcloud): Tag webhook backlog depth by event type - #121601
Merged
Merged
Conversation
The mailbox gauges from #121506 report the backlog per provider — who sent the queued webhooks, not what they are. Sizing a parser-side drop needs the latter: #121434 dropped 13.6M unconsumed check_suite deliveries a day, and the follow-up it names, dropping check_run.completed payloads that reference no pull request in their own repo, has no backlog number behind it yet. GitHub mailboxes already carry the answer — get_mailbox_identifier appends the event type so deliveries of different types don't queue behind each other — and the aggregate already groups by mailbox_name. The dimension is a re-key of rows already in memory, so it costs no extra query. Only pending_count gets the tag. Every emission is host-tagged by the Datadog backend, so each value costs a series per worker that runs the task, and the other three gauges read fine per provider: GitHub mailboxes are per-event-type by construction, so max_depth is already one event type's mailbox and pending_count names which one. Summing pending_count over event_type reproduces the provider-only value, so anything built on the existing series keeps working.
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.
Problem
The mailbox gauges from #121506 report the backlog per provider — who sent the queued webhooks, not what they are. Sizing a parser-side drop needs the latter.
#121434 dropped 13.6M unconsumed
check_suitedeliveries a day. The follow-up it names — droppingcheck_run.completedpayloads that reference no pull request based in their own repo, the largest remaining line at 12.1M/day — has an inflow number (github.webhook.forwarded_event) and a latency number (delivery_time_ms{github_event_and_action}), but nothing that says what is actually sitting in the mailboxes. That is the INC-2324/INC-2421 question, and today it is only answerable per provider.Changes
hybridcloud.webhookpayload.mailbox.pending_countgains anevent_typetag.GitHub mailboxes already carry the answer.
GithubRequestParser.get_mailbox_identifierappends the event type to the mailbox name so deliveries of different types don't queue behind each other (GithubEnterpriseRequestParserinherits it), and the aggregate already groups bymailbox_name. So this is a re-key of rows that are in memory either way — no extra query, no change to the statement-timeout envelope.Two things the derivation has to get right:
X-GitHub-Eventheader mailboxes without the suffix, leaving a bucket number where this reads. Tagging that verbatim would put unbounded ints in a tag, so only names inCELL_PROCESSED_GITHUB_EVENTSare trusted; anything else isunknown.none(provider doesn't mailbox by event type) is kept distinct fromunknown(it does, but this mailbox has none to read). Conflating them would hide the header-less deliveries.It reads the
providercolumn rather than the mailbox prefix, so legacy rows predating that column reportnoneeven when they are GitHub mailboxes. Those are draining out, and deriving a provider two different ways is worse than under-reporting them.Why only
pending_countEvery emission is host-tagged by the Datadog backend, so each tag value costs a series per worker that runs the task. Tagging all four gauges would take this from
4 × 7 providersto4 × 25combinations; confining it topending_countmakes that3 × 7 + 25.The other three read fine per provider:
max_depth— GitHub mailboxes are per-event-type by construction, so this is already one event type's mailbox. The tag would only name which one, andpending_countnames it.active_count— a routing/fan-out signal, not a composition one.oldest_pending_age_seconds— a single stalled event type does hide inside the provider-wide age. That is an alerting concern for INC-2421 and a one-line addition if that work wants it; not worth paying for speculatively.Kept the full 9-event set rather than a hardcoded high-volume subset with an
otherbucket. That would be cheaper, but the list would go stale silently and hide the nextcheck_suite— the exact thing this exists to catch. The 9 are bounded and grow only when someone adds aGithubWebhookType.Compatibility
Summing
pending_countoverevent_typereproduces the provider-only value, so anything built on the existing series keeps working. No in-repo consumers reference these metric names.