-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔧 chore(discord): change rate limits to halt for SLOs #83656
base: master
Are you sure you want to change the base?
Conversation
lifecycle.add_extras( | ||
{ | ||
"incident_id": incident.id, | ||
"channel_id": channel, | ||
} | ||
) | ||
lifecycle.record_failure(error) | ||
if isinstance(error, ApiRateLimitedError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I largely agree that this is a user-caused issue now, this might be problematic for users with larger orgs in the future if they decide to use the discord integration. We don't have to address this now, but we may want to consider having some mechanism to backlog and batch in the future (if possible).
responses.add( | ||
method=responses.POST, | ||
url=f"{DISCORD_BASE_URL}{MESSAGE_URL.format(channel_id=self.channel_id)}", | ||
json={}, | ||
status=200, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this if the setup is already setting a mock response, and we're asserting that it's not called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
@mock.patch("sentry.integrations.utils.metrics.EventLifecycle.record_event") | ||
def assert_lifecycle_metrics_halt_for_rate_limit(self, mock_record_event, mock_send_message): | ||
assert_slo_metric(mock_record_event, EventLifecycleOutcome.HALTED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this defined, but I don't see this used anywhere.
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #83656 +/- ##
========================================
Coverage 87.57% 87.58%
========================================
Files 9492 9492
Lines 539296 539414 +118
Branches 21219 21219
========================================
+ Hits 472310 472460 +150
+ Misses 66637 66605 -32
Partials 349 349 |
one org has a extremely noisy alert (~4k fires in a single week) and its been severely ratelimited by discord. this however impacts our slos since we currently record rate limits as failures instead of halts.
also wrote some basic test cases for discord incident alert handler b/c we didn't have any 😬