Skip to content

feat(webhooks): Add metrics for legacy webhook migration validation#116039

Merged
Christinarlong merged 5 commits into
masterfrom
Christinarlong/webhooks-metrics-fix
May 21, 2026
Merged

feat(webhooks): Add metrics for legacy webhook migration validation#116039
Christinarlong merged 5 commits into
masterfrom
Christinarlong/webhooks-metrics-fix

Conversation

@Christinarlong
Copy link
Copy Markdown
Contributor

the one where i dont ping the whole company

…ng migration

Instruments both the legacy plugin and the new webhook task with
`metrics.incr` counters so we can validate dry-run parity:
- `legacy_webhook.plugin.send` (old path, per-URL sent/error)
- `legacy_webhook.task.result` (new path, per-URL sent/dry_run/group_not_found)
…sends

Introduce LegacyWebhookOutcome enum per review feedback. Add try/except
around client.request() in the task so failed sends emit an error metric
before re-raising—previously silenced_exceptions swallowed the exception
with no metric recorded. Expand the plugin's except clause to also catch
ApiError and RestrictedIPAddress for metric parity.
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 21, 2026
@Christinarlong Christinarlong marked this pull request as ready for review May 21, 2026 18:04
Comment thread src/sentry/plugins/sentry_webhooks/plugin.py Outdated
Comment thread src/sentry/plugins/sentry_webhooks/plugin.py
Catching these exceptions without re-raising broke the parent
NotificationPlugin.notify() error propagation chain, causing the
"Test Plugin" button to falsely report success and suppressing
notification-plugin.notify-failed logging.
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 006e6d2. Configure here.

Comment thread src/sentry/plugins/sentry_webhooks/plugin.py
except (RestrictedIPAddress, ApiError):
metrics.incr(
"legacy_webhook.plugin.send",
tags={"outcome": LegacyWebhookOutcome.ERROR},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to include a tag with the exception type?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its fine, the exception type itself doesn't really matter I just want to track that the total no. of webhooks is the same

@Christinarlong Christinarlong merged commit 8b6bd83 into master May 21, 2026
62 checks passed
@Christinarlong Christinarlong deleted the Christinarlong/webhooks-metrics-fix branch May 21, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants