-
-
Notifications
You must be signed in to change notification settings - Fork 461
Report discarded log bytes #4871
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
Conversation
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 806307f | 357.85 ms | 424.64 ms | 66.79 ms |
| ee747ae | 554.98 ms | 611.50 ms | 56.52 ms |
| 17a0955 | 372.53 ms | 446.70 ms | 74.17 ms |
| 2124a46 | 319.19 ms | 415.04 ms | 95.85 ms |
| 9fbb112 | 404.51 ms | 475.65 ms | 71.14 ms |
| b6702b0 | 395.86 ms | 409.98 ms | 14.12 ms |
| ee747ae | 357.79 ms | 421.84 ms | 64.05 ms |
| 27d7cf8 | 314.17 ms | 347.00 ms | 32.83 ms |
| 9fbb112 | 361.43 ms | 427.57 ms | 66.14 ms |
| 96449e8 | 361.30 ms | 423.39 ms | 62.09 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 806307f | 1.58 MiB | 2.10 MiB | 533.42 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| 17a0955 | 1.58 MiB | 2.10 MiB | 533.20 KiB |
| 2124a46 | 1.58 MiB | 2.12 MiB | 551.51 KiB |
| 9fbb112 | 1.58 MiB | 2.11 MiB | 539.18 KiB |
| b6702b0 | 1.58 MiB | 2.12 MiB | 551.79 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| 27d7cf8 | 1.58 MiB | 2.12 MiB | 549.42 KiB |
| 9fbb112 | 1.58 MiB | 2.11 MiB | 539.18 KiB |
| 96449e8 | 1.58 MiB | 2.11 MiB | 539.35 KiB |
Previous results on branch: feat/report-discarded-log-bytes
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| fff4795 | 309.94 ms | 370.50 ms | 60.56 ms |
| 28b566b | 316.37 ms | 364.56 ms | 48.19 ms |
| 38a53b3 | 368.63 ms | 443.27 ms | 74.63 ms |
| c63bfc6 | 368.17 ms | 374.78 ms | 6.60 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| fff4795 | 1.58 MiB | 2.12 MiB | 551.81 KiB |
| 28b566b | 1.58 MiB | 2.12 MiB | 551.58 KiB |
| 38a53b3 | 1.58 MiB | 2.12 MiB | 552.02 KiB |
| c63bfc6 | 1.58 MiB | 2.12 MiB | 553.32 KiB |
stefanosiano
left a comment
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.
Looks good for the most part, but reading the doc i understood we shouldn't count json characters in the byte size, which we are doing here
Perhaps a simple method in the log object that counts each key and value bytes is a good alternative?
|
We're currently discussing, whether this simplified count as if it were serialized is OK or if we want to replicate what relay is doing. |
alexander-alderman-webb
left a comment
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.
Looks good!
To record: no scientific byte count needed, as users are not billed on logs that are dropped in the SDK. So while the logic differs slightly from relay, counting the bytes in the serialized JSON emitted by the SDK seems like the most pragmatic choice and good enough for this use case.
sentry/src/main/java/io/sentry/util/JsonSerializationUtils.java
Outdated
Show resolved
Hide resolved
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.
Bug: Untracked Log Bytes Skew Reports
When processLogEvent drops a log event via event processors, it only records DataCategory.LogItem but not DataCategory.LogByte. This is inconsistent with beforeSendLog handling (lines 1189-1200) where both categories are recorded. Event processors can drop logs at lines 1172-1175 and 1179-1182, causing discarded log bytes to not be tracked in client reports for these code paths.
sentry/src/main/java/io/sentry/SentryClient.java#L472-L502
sentry-java/sentry/src/main/java/io/sentry/SentryClient.java
Lines 472 to 502 in 4a585ad
| @Nullable | |
| private SentryLogEvent processLogEvent( | |
| @NotNull SentryLogEvent event, final @NotNull List<EventProcessor> eventProcessors) { | |
| for (final EventProcessor processor : eventProcessors) { | |
| try { | |
| event = processor.process(event); | |
| } catch (Throwable e) { | |
| options | |
| .getLogger() | |
| .log( | |
| SentryLevel.ERROR, | |
| e, | |
| "An exception occurred while processing log event by processor: %s", | |
| processor.getClass().getName()); | |
| } | |
| if (event == null) { | |
| options | |
| .getLogger() | |
| .log( | |
| SentryLevel.DEBUG, | |
| "Log event was dropped by a processor: %s", | |
| processor.getClass().getName()); | |
| options | |
| .getClientReportRecorder() | |
| .recordLostEvent(DiscardReason.EVENT_PROCESSOR, DataCategory.LogItem); | |
| break; | |
| } | |
| } | |
| return event; | |
| } |
📜 Description
Report discarded log size in bytes as part of client reports.
💡 Motivation and Context
Since log count is not shown to customers in UI, we want to report log size too.
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps