-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
fix: Don't increase session's error count for dropped events #2374
fix: Don't increase session's error count for dropped events #2374
Conversation
Only do this after running the beforeSend block
With this small change we first check if we still have an event after running the Second question: is this only for errors or also for exceptions? I.e. the whole |
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
f444dc4 | 1242.55 ms | 1248.82 ms | 6.27 ms |
0fdf0b2 | 1243.92 ms | 1250.86 ms | 6.94 ms |
59afa00 | 1209.29 ms | 1237.88 ms | 28.59 ms |
411a940 | 1232.33 ms | 1259.33 ms | 27.01 ms |
6dc0bd1 | 1220.49 ms | 1237.44 ms | 16.95 ms |
9754750 | 1234.71 ms | 1265.21 ms | 30.49 ms |
c2a9b60 | 1222.10 ms | 1240.62 ms | 18.52 ms |
791123d | 1217.52 ms | 1253.08 ms | 35.56 ms |
4e037c4 | 1205.00 ms | 1227.58 ms | 22.58 ms |
b15627c | 1228.88 ms | 1269.70 ms | 40.82 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
f444dc4 | 20.75 KiB | 367.00 KiB | 346.25 KiB |
0fdf0b2 | 20.51 KiB | 332.90 KiB | 312.39 KiB |
59afa00 | 20.50 KiB | 365.16 KiB | 344.65 KiB |
411a940 | 20.50 KiB | 361.79 KiB | 341.29 KiB |
6dc0bd1 | 20.51 KiB | 333.58 KiB | 313.07 KiB |
9754750 | 20.75 KiB | 374.16 KiB | 353.41 KiB |
c2a9b60 | 20.50 KiB | 333.54 KiB | 313.04 KiB |
791123d | 20.51 KiB | 331.81 KiB | 311.30 KiB |
4e037c4 | 20.50 KiB | 361.80 KiB | 341.29 KiB |
b15627c | 20.50 KiB | 337.76 KiB | 317.25 KiB |
Previous results on branch: feat/1777-no-session-update-for-dropped-events
Startup times
Revision | Plain | With Sentry | Diff |
---|---|---|---|
0d5ca6b | 1249.73 ms | 1270.78 ms | 21.05 ms |
041dc77 | 1254.86 ms | 1274.57 ms | 19.71 ms |
3ca16ab | 1251.62 ms | 1279.98 ms | 28.36 ms |
50e4603 | 1226.04 ms | 1251.92 ms | 25.88 ms |
db3535b | 1190.22 ms | 1221.26 ms | 31.04 ms |
50e4603 | 1196.42 ms | 1227.18 ms | 30.76 ms |
9f1fe4c | 1263.76 ms | 1269.14 ms | 5.38 ms |
5000a1e | 1251.86 ms | 1270.22 ms | 18.36 ms |
db3535b | 1227.28 ms | 1253.43 ms | 26.15 ms |
457f28e | 1239.00 ms | 1250.72 ms | 11.72 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
0d5ca6b | 20.75 KiB | 374.53 KiB | 353.78 KiB |
041dc77 | 20.75 KiB | 374.19 KiB | 353.44 KiB |
3ca16ab | 20.75 KiB | 374.61 KiB | 353.86 KiB |
50e4603 | 20.75 KiB | 374.61 KiB | 353.86 KiB |
db3535b | 20.75 KiB | 374.12 KiB | 353.37 KiB |
50e4603 | 20.75 KiB | 374.61 KiB | 353.86 KiB |
9f1fe4c | 20.75 KiB | 374.24 KiB | 353.48 KiB |
5000a1e | 20.75 KiB | 367.28 KiB | 346.52 KiB |
db3535b | 20.75 KiB | 374.13 KiB | 353.37 KiB |
457f28e | 20.75 KiB | 374.50 KiB | 353.74 KiB |
Don't the docs state that clearly?
These docs don't mention rate limiting, though. I'm going to clarify this. So just ignore it for now. Basically, we need to change when we increment the session error count in the hub. I think the only change for our SDK now is to check if the event gets dropped in beforeSend or in an event processor. So we need to refactor the code that only if the event doesn't get dropped there, we update the session. That applies to anything updating the session, meaning exceptions, errors, events, crashes, etc. . I'm unsure what the best way is to solve this. Can you suggest a concept in this draft PR? |
I do have a concept for error catching, and I guess this can pretty easily be extended to other events and exceptions and stuff. |
@kevinrenskers, rate limited events should update the session, see getsentry/develop#756. |
Yes, rate limiting happens after this code runs so is unaffected by this change. |
I don't think you've answered the most important question:
Can I please get some input on the code change I have made, if this is on the correct path, and if my assumption is correct? |
…ents * master: test: Fix MetricKit attachment filename (#2379)
…ents * master: build(deps): bump github/codeql-action from 2.1.31 to 2.1.32 (#2386) build(deps): bump fastlane from 2.210.1 to 2.211.0 (#2385) ref: json serialization error reporting (#2355) release: 7.31.0 ref: Fix outdated comment in SessionTracker (#2381) fix: Do not delete the app state (#2382) build: Split Swift and Clang format for pre-commit (#2380)
…ents * master: Fix: Set the correct OOM event timestamp (#2394) test: Fix SentrySerializationTests.testSerializationFailsWithInvalidJSONObject (#2392) feat(hybrid-sdks): Add captureScreenshots to PrivateSDKOnly (#2384) ci: Increase test timeout for iOS 12 (#2391) test: Disable flaky testCrashReportCount1 (#2389) test: Disable flaky testSerializeWithUnderlyingNSException (#2387)
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.
One important issue to address. Apart from that already looks great 😀
sut.capture(error: fixture.error, scope: fixture.scope).assertIsNotEmpty() | ||
|
||
XCTAssertEqual(1, fixture.client.captureErrorWithSessionInvocations.count) | ||
if let errorArguments = fixture.client.captureErrorWithSessionInvocations.first { |
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.
h
: Sorry, I think I forgot to mention that yesterday on our call, or maybe we didn't touch that topic. If we don't increment the error count, there is not need to send a session update, as the session stays the same. In that case, we should only send the event without the session.
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've made the change as we discussed at 14:30 but actually it doesn't change anything - we already didn't send the session update if the event was nil. That's because even though yes we were calling [self sendEvent:event withSession:session withScope:scope]
, that doesn't do anything at all if there is no event.
So in the end the most recent commit is just cleaning up, but doesn't change any behavior as nothing needed fixing.
Co-authored-by: Philipp Hofmann <[email protected]>
Co-authored-by: Philipp Hofmann <[email protected]>
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.
Thank you @kevinrenskers 👏
@@ -4,6 +4,7 @@ | |||
|
|||
### Fixes | |||
|
|||
- Don't update session for dropped events (#2374) |
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.
m
: That needs to move up a bit.
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.
It would be really nice to automate the changelogs :(
Like https://github.com/loopwerk/tag-changelog, or the many many other solutions out there.
* 8.0.0: ref: Fix typos in OOMTracker (#2431) ref: Make SpanProtocol.data non nullable (#2409) ref: add/improve logging (#2420) ref: bump supported OS versions (#2414) test: shorten some tests (#2428) ref: Remove `- [SentryOptions initWithDict:didFailWithError:]` (#2404) ref: Mark [SpanProtocol setExtraValue:forKey] as deprecated (#2413) typos (#2421) test: Disable NSDataTracker in clearTestState (#2418) Update CHANGELOG.md (#2415) feat: Properly demangle Swift class name (#2162) chore: Create 8.0.0 branch test: include Sentry changes in hash keys (#2412) release: 7.31.2 fix: Crash in Client when reading integrations (#2398) test: tooling improvements (#2400) fix: Don't increase session's error count for dropped events (#2374) Update CHANGELOG.md (#2396) release: 7.31.1 Fix: Set the correct OOM event timestamp (#2394) # Conflicts: # Sentry.xcodeproj/project.pbxproj # SentryPrivate.podspec # scripts/add-sentry-to-vlc.patch
* master: (56 commits) meta: disable swiftlint file length check in TBDBClient.swift (#2435) Revert "test: shorten some tests (#2422)" (#2427) test: shorten some tests (#2422) test: include Sentry changes in hash keys (#2412) release: 7.31.2 fix: Crash in Client when reading integrations (#2398) test: tooling improvements (#2400) fix: Don't increase session's error count for dropped events (#2374) Update CHANGELOG.md (#2396) release: 7.31.1 Fix: Set the correct OOM event timestamp (#2394) test: Fix SentrySerializationTests.testSerializationFailsWithInvalidJSONObject (#2392) feat(hybrid-sdks): Add captureScreenshots to PrivateSDKOnly (#2384) ci: Increase test timeout for iOS 12 (#2391) test: Disable flaky testCrashReportCount1 (#2389) test: Disable flaky testSerializeWithUnderlyingNSException (#2387) build(deps): bump github/codeql-action from 2.1.31 to 2.1.32 (#2386) build(deps): bump fastlane from 2.210.1 to 2.211.0 (#2385) ref: json serialization error reporting (#2355) release: 7.31.0 ...
📜 Description
Don't immediately update the session's error count. Only do this after running the beforeSend block.
💡 Motivation and Context
Closes #1777
💚 How did you test it?
Unit tests
📝 Checklist
🔮 Next steps