feat: Record log_byte client reports#8186
Conversation
Adds kSentryDataCategoryLogByte (= "log_byte") as a new data category alongside the existing kSentryDataCategoryLogItem. The byte category tracks how many bytes of log envelope data were discarded, matching the client-reports spec at https://develop.sentry.dev/sdk/telemetry/client-reports/ Changes: - SentryDataCategory.h: add kSentryDataCategoryLogByte = 15; shift kSentryDataCategoryUnknown to 16 - SentryDataCategoryMapper.h/m: add kSentryDataCategoryNameLogByte constant ("log_byte") and wire it through sentryDataCategoryForString, nameForSentryDataCategory - SentryHttpTransport.m: add recordLostLogBytes:reason: helper that records item.data.length bytes under kSentryDataCategoryLogByte; call it alongside the existing recordLostEvent / recordLostSpans calls in envelopeItemDropped:withCategory:, envelopeItemDeleted:withCategory:, and recordLostEventFor: - SentryDataCategoryMapperTests.swift: extend integer, string, and name-to-category round-trip tests to cover kSentryDataCategoryLogByte
|
Likewise here - thanks for your contribution! I've kicked off the CI, but would like another member of the team to verify this. I'd also suggest stacking it on #8185 so that the 'unknown' enum is correctly incremented across the changes. |
philipphofmann
left a comment
There was a problem hiding this comment.
Thanks a lot @tsushanth
099c205 to
10a3c60
Compare
|
Added CHANGELOG entry under |
Add HTTP transport tests for log_byte recording on the rate-limit, cache-overflow, and send-error drop paths. Document why beforeSendLog only records log_item.
Record log_item and log_byte client outcomes when a log is dropped by beforeSendLog. The byte size is computed on a background queue so the calling thread isn't blocked.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit dc22393. Configure here.
|
@tsushanth, thanks a lot for your help. I took the freedom and finished the PR. @itaybre, @philprime or @NinjaLikesCheez please give this PR another review, because I can't review my own code please. |

📜 Description
Record the
log_byteclient outcome (the byte size of dropped logs) alongside the existinglog_itemcount, so we report the volume of discarded log data as required by the client reports spec.This covers logs dropped in the transport (rate limit, cache overflow, send errors) and by the
beforeSendLogcallback.💡 Motivation and Context
Fixes #8175.
💚 How did you test it?
Added unit tests for each drop path and for the byte-size calculation, including the encoding-failure fallback.
📝 Checklist
You have to check all boxes before merging:
sendDefaultPIIis enabled.