Skip to content

(WIP) feat(client-reports): report log and metric byte outcomes - #1927

Draft
JoshuaMoelans wants to merge 1 commit into
masterfrom
joshua/fix/client_reports_log_bytes
Draft

(WIP) feat(client-reports): report log and metric byte outcomes#1927
JoshuaMoelans wants to merge 1 commit into
masterfrom
joshua/fix/client_reports_log_bytes

Conversation

@JoshuaMoelans

Copy link
Copy Markdown
Member

Record the byte size of discarded logs and metrics under the log_byte and trace_metric_byte categories, alongside the existing log_item and trace_metric counts, as required by
https://develop.sentry.dev/sdk/telemetry/client-reports/#log-byte-outcomes

Byte sizes come from the serialized payload where an item is already serialized, and from a new allocation-free sentry_value_t size estimator on the before_send_log / before_send_metric and batcher overflow paths. The hooks take ownership of the value, so it is sized before the call.

This also fixes the item count for batched envelope items: discarding a log or trace_metric item now reports every log in the batch via its item_count header instead of counting the whole item as one discard.

Following https://develop.sentry.dev/sdk/telemetry/client-reports/#log-byte-outcomes

Record the byte size of discarded logs and metrics under the `log_byte`
and `trace_metric_byte` categories, alongside the existing `log_item` and
`trace_metric` counts, as required by
https://develop.sentry.dev/sdk/telemetry/client-reports/#log-byte-outcomes

Byte sizes come from the serialized payload where an item is already
serialized, and from a new allocation-free `sentry_value_t` size estimator
on the `before_send_log` / `before_send_metric` and batcher overflow paths.
The hooks take ownership of the value, so it is sized before the call.

This also fixes the item count for batched envelope items: discarding a
`log` or `trace_metric` item now reports every log in the batch via its
`item_count` header instead of counting the whole item as one discard.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Features

- report log and metric byte outcomes ([#1927](https://github.com/getsentry/sentry-native/pull/1927))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against a771d81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant