ref(envelopes): Move rate limiting logic to each item in envelope#1742
ref(envelopes): Move rate limiting logic to each item in envelope#1742
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1742 +/- ##
==========================================
+ Coverage 98.39% 98.42% +0.02%
==========================================
Files 141 141
Lines 8030 8046 +16
==========================================
+ Hits 7901 7919 +18
+ Misses 129 127 -2
Continue to review full report at Codecov.
|
sentry-ruby/lib/sentry/transport.rb
Outdated
| [item_header, item_payload] | ||
| end | ||
|
|
||
| def process_rate_limits(envelope) |
There was a problem hiding this comment.
I think reject_rate_limited_items gives a better intention here. Or it's possible to extend this method in the future?
| def process_rate_limits(envelope) | ||
| envelope.items.reject! do |item| | ||
| if is_rate_limited?(item.type) | ||
| log_info("[Transport] Envelope item [#{item.type}] not sent: rate limiting") |
There was a problem hiding this comment.
Not related to this PR: I'm thinking downgrading most of the info logs to debug level. Because from my experience, we rarely need to know the sent events, not even in debugging. Wdyt?
There was a problem hiding this comment.
yea makes sense, will do
There was a problem hiding this comment.
hmm let's do this in a separate PR, I'll need to change a lot of specs otherwise :)
There was a problem hiding this comment.
Yeah I didn't mean we should change it here. And we should also change some other places instead of just here..
|
@sl0thentr0py btw we'll need a changelog entry for this as well. |
This makes the envelope logic a bit more consistent to other SDKs because the rate limits can apply to each item in the envelope separately. This is necessary to be able to work with session envelopes in #1715.