-
-
Notifications
You must be signed in to change notification settings - Fork 474
Optimize DuplicateEventDetectionEventProcessor performance. #1247
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
Merged
maciejwalkowiak
merged 10 commits into
main
from
optimize-deduplication-event-processor
Feb 18, 2021
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3ce6d4c
Optimize DuplicateEventDetectionEventProcessor performance.
maciejwalkowiak 7c2b411
Fix Android compatiblility.
maciejwalkowiak d6b75c9
Changelog.
maciejwalkowiak fe1c9c1
Changelog.
maciejwalkowiak 9d46cfb
Merge remote-tracking branch 'origin/main' into optimize-deduplicatio…
maciejwalkowiak a66b5ad
Add a flag to disable deduplication.
maciejwalkowiak 0497e68
Api.
maciejwalkowiak 065e73e
Synchronize WeakHashMap.
maciejwalkowiak 4d21932
Log when deduplication is disabled.
maciejwalkowiak 68e4929
Merge branch 'main' into optimize-deduplication-event-processor
maciejwalkowiak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,10 +9,22 @@ import kotlin.test.assertNull | |
|
|
||
| class DuplicateEventDetectionEventProcessorTest { | ||
|
|
||
| val processor = DuplicateEventDetectionEventProcessor(SentryOptions()) | ||
| class Fixture { | ||
| fun getSut(enableDeduplication: Boolean? = null): DuplicateEventDetectionEventProcessor { | ||
| val options = SentryOptions().apply { | ||
| if (enableDeduplication != null) { | ||
| this.setEnableDeduplication(enableDeduplication) | ||
| } | ||
| } | ||
|
Comment on lines
+14
to
+18
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you could init |
||
| return DuplicateEventDetectionEventProcessor(options) | ||
| } | ||
| } | ||
|
|
||
| var fixture = Fixture() | ||
|
|
||
| @Test | ||
| fun `does not drop event if no previous event with same exception was processed`() { | ||
| val processor = fixture.getSut() | ||
| processor.process(SentryEvent(), null) | ||
|
|
||
| val result = processor.process(SentryEvent(RuntimeException()), null) | ||
|
|
@@ -22,6 +34,7 @@ class DuplicateEventDetectionEventProcessorTest { | |
|
|
||
| @Test | ||
| fun `drops event with the same exception`() { | ||
| val processor = fixture.getSut() | ||
| val event = SentryEvent(RuntimeException()) | ||
| processor.process(event, null) | ||
|
|
||
|
|
@@ -31,6 +44,7 @@ class DuplicateEventDetectionEventProcessorTest { | |
|
|
||
| @Test | ||
| fun `drops event with mechanism exception having an exception that has already been processed`() { | ||
| val processor = fixture.getSut() | ||
| val event = SentryEvent(RuntimeException()) | ||
| processor.process(event, null) | ||
|
|
||
|
|
@@ -40,6 +54,7 @@ class DuplicateEventDetectionEventProcessorTest { | |
|
|
||
| @Test | ||
| fun `drops event with exception that has already been processed with event with mechanism exception`() { | ||
| val processor = fixture.getSut() | ||
| val sentryEvent = SentryEvent(ExceptionMechanismException(Mechanism(), RuntimeException(), Thread.currentThread())) | ||
| processor.process(sentryEvent, null) | ||
|
|
||
|
|
@@ -50,6 +65,7 @@ class DuplicateEventDetectionEventProcessorTest { | |
|
|
||
| @Test | ||
| fun `drops event with the cause equal to exception in already processed event`() { | ||
| val processor = fixture.getSut() | ||
| val event = SentryEvent(RuntimeException()) | ||
| processor.process(event, null) | ||
|
|
||
|
|
@@ -60,11 +76,20 @@ class DuplicateEventDetectionEventProcessorTest { | |
|
|
||
| @Test | ||
| fun `drops event with any of the causes has been already processed`() { | ||
| val processor = fixture.getSut() | ||
| val event = SentryEvent(RuntimeException()) | ||
| processor.process(event, null) | ||
|
|
||
| val result = processor.process(SentryEvent(RuntimeException(RuntimeException(event.throwable))), null) | ||
|
|
||
| assertNull(result) | ||
| } | ||
|
|
||
| @Test | ||
| fun `does not deduplicate is deduplication is disabled`() { | ||
| val processor = fixture.getSut(enableDeduplication = false) | ||
| val event = SentryEvent(RuntimeException()) | ||
| assertNotNull(processor.process(event, null)) | ||
| assertNotNull(processor.process(event, null)) | ||
| } | ||
| } | ||
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
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.
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.
should also go under the
breaking changesectionThere 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's changing the algorithm that sits under the hood. I am not sure why this would be qualified as a breaking change.
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.
its a behavior change, there's a
bufferSizenow and there is the possibility to report the same exception twice, right?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.
Unlikely, only if applications sends hundreds/thousands errors per second. Buffer size is hidden from the user. I can add it to breaking change if you like but I don't believe we should bump a version because of this.