Repository navigation
feat(hybridcloud): Tag webhook delivery metrics by provider - #121609
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c962807. Configure here.
vaind
added a commit
that referenced
this pull request
Aug 10, 2026
…cord `drain_mailbox` loops over records but keeps a separate reference to the mailbox head, and the retry counter read the head. Every other delivery outcome reads the record it describes — `ok` and `attempts_exceed` via `deliver_message`, and the whole parallel path via `payload_record` — so the same webhook could be attributed to two providers depending on how it ended. Only reachable through the nullable provider column, since a mailbox name pins the provider for every row in it, and production currently has no null-provider rows. Fixing it anyway: the parallel path already reads the record, and the cost is one word. Reported by Cursor Bugbot on #121609.
joseph-sentry
approved these changes
Aug 10, 2026
The 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. Selecting a provider therefore does not
filter those widgets, it blanks them, which reads as "no traffic" rather than
"this metric cannot answer that question".
Tagging them 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.
Provider comes from the payload column where a row is loaded. Two paths have no
row — the push trigger, and the DoesNotExist race — so they read the first
segment of the mailbox name instead; bucket and event-type suffixes attach to
the identifier, so that segment stays the provider. The column is nullable and
rows predating it still drain through, hence the `unknown` fallback, matching
`record_mailbox_depth_metrics`.
Left untagged deliberately: the `send_request` timer, which would multiply seven
series per cell for a latency question `delivery_time_ms` already answers, and
`schedule_webhook_delivery.mailbox_count`, which aggregates across providers.
…cord `drain_mailbox` loops over records but keeps a separate reference to the mailbox head, and the retry counter read the head. Every other delivery outcome reads the record it describes — `ok` and `attempts_exceed` via `deliver_message`, and the whole parallel path via `payload_record` — so the same webhook could be attributed to two providers depending on how it ended. Only reachable through the nullable provider column, since a mailbox name pins the provider for every row in it, and production currently has no null-provider rows. Fixing it anyway: the parallel path already reads the record, and the cost is one word. Reported by Cursor Bugbot on #121609.
vaind
force-pushed
the
ref/webhook-provider-metric-tag
branch
from
August 10, 2026 17:07
43cfc61 to
03ab175
Compare
vaind
enabled auto-merge (squash)
August 10, 2026 17:09
vaind
added a commit
that referenced
this pull request
Aug 10, 2026
## Problem `hybridcloud.deliver_webhooks.delivery_time_ms` is tagged with `region_sent_to` and, for GitHub, `github_event_and_action` — but not `provider`. A latency regression confined to one integration is invisible until it is large enough to move the aggregate, and the `$provider` selector on the Hybrid Cloud Webhook Forwarding dashboard cannot reach the latency charts at all. #121609 added a `provider` tag to every `delivery`, `failure`, `saved` and `push_trigger.*` emission. `delivery_time_ms` was left out because it is emitted from a different helper; this closes that gap. ## Change `_record_delivery_time_metrics` now includes `provider` via the existing `_provider_tag` helper, so payloads predating the nullable `provider` column report `unknown` rather than dropping the tag. The three existing `DeliveryTimeMetricsTest` cases already cover the branches that matter, so they gained assertions instead of new tests: a payload with no provider (`unknown`), a GitHub payload (`github`), and a non-GitHub payload (`stripe`). ## No Datadog config needed The metrics in #121609 sit behind an allowlist tag configuration that has to be widened before `provider` becomes queryable. `delivery_time_ms` configures tags by *exclusion* — only infra tags are stripped — so `provider` is queryable as soon as it is emitted.
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.

Why
The Hybrid Cloud Webhook Forwarding dashboard has a
providertemplate variable, butdeliver_webhooks.{delivery,saved,failure}carry no such tag — only thewebhookpayload.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
failureare ~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:
maybe_trigger_drainonly receives a mailbox nameBoth 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 theunknownfallback — matching whatrecord_mailbox_depth_metricsalready does.Rebased onto #121606
That PR added two new
deliveryoutcomes —conflictanddropped_4xx— for payloads a cell permanently rejects. Both are tagged here too, so everydeliveryemission carriesprovider; 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_requesttimer — a timer is seven series, so this would be 7 × cells × providers, for a latency questiondelivery_time_msalready 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
deliverygoes to outcome × provider,failureto reason × cell × provider. Provider values are bounded by the integration list — Datadog currently sees 10 distinct values on the mailbox gauges.