-
-
Notifications
You must be signed in to change notification settings - Fork 307
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
impr: Remove not needed log for logging #3934
Merged
Merged
Conversation
This file contains 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
Every log message needs to acquire a lock to evaluate whether the logger should log it. #3303 added this logic to fix a data race the thread sanitizer job found. As the SDK only calls the configure method when starting, we don't need to put a synchronized keyword around the code that evaluates the log level. This PR replaces the synchronized keyword by ignoring the thread sanitizer.
brustolin
approved these changes
May 3, 2024
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3934 +/- ##
=============================================
- Coverage 90.686% 89.686% -1.000%
=============================================
Files 582 581 -1
Lines 45524 45241 -283
Branches 16218 15839 -379
=============================================
- Hits 41284 40575 -709
- Misses 4170 4596 +426
Partials 70 70
... and 94 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
7fb7afb | 1202.18 ms | 1219.42 ms | 17.24 ms |
a9103fe | 1221.49 ms | 1243.33 ms | 21.84 ms |
626b91b | 1231.67 ms | 1247.13 ms | 15.46 ms |
2cf1b84 | 6265.25 ms | 6277.98 ms | 12.73 ms |
2b19b82 | 1226.73 ms | 1243.27 ms | 16.53 ms |
160a2a7 | 1219.29 ms | 1240.96 ms | 21.67 ms |
a71f5e2 | 1245.27 ms | 1258.00 ms | 12.73 ms |
4a947cf | 1230.73 ms | 1239.38 ms | 8.65 ms |
965db8a | 1211.61 ms | 1226.60 ms | 14.99 ms |
5b3518e | 1242.27 ms | 1257.81 ms | 15.55 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
7fb7afb | 20.76 KiB | 419.70 KiB | 398.94 KiB |
a9103fe | 20.76 KiB | 426.95 KiB | 406.19 KiB |
626b91b | 21.58 KiB | 546.20 KiB | 524.61 KiB |
2cf1b84 | 20.76 KiB | 431.91 KiB | 411.15 KiB |
2b19b82 | 21.58 KiB | 542.18 KiB | 520.60 KiB |
160a2a7 | 21.58 KiB | 614.86 KiB | 593.28 KiB |
a71f5e2 | 21.58 KiB | 424.34 KiB | 402.76 KiB |
4a947cf | 20.76 KiB | 399.69 KiB | 378.92 KiB |
965db8a | 22.84 KiB | 403.24 KiB | 380.39 KiB |
5b3518e | 21.58 KiB | 612.11 KiB | 590.53 KiB |
philipphofmann
added a commit
that referenced
this pull request
May 6, 2024
Every log message needs to acquire a lock to evaluate whether the logger should log it. #3303 added this logic to fix a data race the thread sanitizer job found. As the SDK only calls the configure method when starting, we don't need to put a synchronized keyword around the code that evaluates the log level. This PR replaces the synchronized keyword by ignoring the thread sanitizer.
dKasabwala
pushed a commit
to dKasabwala/sentry-cocoa
that referenced
this pull request
May 6, 2024
Every log message needs to acquire a lock to evaluate whether the logger should log it. getsentry#3303 added this logic to fix a data race the thread sanitizer job found. As the SDK only calls the configure method when starting, we don't need to put a synchronized keyword around the code that evaluates the log level. This PR replaces the synchronized keyword by ignoring the thread sanitizer.
threema-matteo
pushed a commit
to threema-ch/sentry-cocoa
that referenced
this pull request
May 21, 2024
Every log message needs to acquire a lock to evaluate whether the logger should log it. getsentry#3303 added this logic to fix a data race the thread sanitizer job found. As the SDK only calls the configure method when starting, we don't need to put a synchronized keyword around the code that evaluates the log level. This PR replaces the synchronized keyword by ignoring the thread sanitizer.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
📜 Description
Every log message needs to acquire a lock to evaluate whether the logger should log it. #3303 added this logic to fix a data race the thread sanitizer job found. As the SDK only calls the configure method when starting, we don't need to put a synchronized keyword around the code that evaluates the log level. This PR replaces the synchronized keyword by ignoring the thread sanitizer.
💡 Motivation and Context
This came up while investigating failing unit tests for #3915. The raw log messages show a 500ms delay in the SentryHttpTransport between two calls that only log a simple message:
SENTRY_LOG_DEBUG(@"No internet connection.");
andSENTRY_LOG_DEBUG(@"Finished sending.");
sentry-cocoa/Sources/Sentry/SentryHttpTransport.m
Lines 354 to 363 in 8aec30e
I don't think the not needed lock is responsible for this, but removing it should improve overall performance of logging.
💚 How did you test it?
Logging still works.
📝 Checklist
You have to check all boxes before merging:
sendDefaultPII
is enabled.🔮 Next steps