Skip to content

fix(client-reports): Count spans in batched span envelope items - #6265

Open
0xadam-brown wants to merge 1 commit into
mainfrom
fix/client-report-span-item-count
Open

0xadam-brown wants to merge 1 commit into
mainfrom
fix/client-report-span-item-count

Conversation

@0xadam-brown

@0xadam-brown 0xadam-brown commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

📜 Description

Prior to this PR, ClientReportRecorder didn't have any explicit logic for dealing with span envelopes because sentry-java didn't implement them. That meant that any span envelopes created by hybrid SDKs (in particular sentry-dart) and dropped by sentry-java would be shunted to the recorder's fallback branch and wrongly register a single dropped span per dropped envelope, rather than the actual number.

This PR fixes adds the missing span envelope logic. Now sentry-java will report the actual span count, rather than 1.

cc @buenaflor

💡 Motivation and Context

Motivated by the Slack convo here and sentry-docs#19854.

Approach matches what we already do for dropped metrics and logs.

💚 How did you test it?

Unit tests

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

@0xadam-brown
0xadam-brown force-pushed the fix/client-report-span-item-count branch from a8bc7a4 to d2ca03c Compare October 15, 2026 12:14
@0xadam-brown
0xadam-brown marked this pull request as ready for review October 15, 2026 12:15
@sentry

sentry Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.61.0 (1) release

⚙️ sentry-android Build Distribution Settings

@buenaflor buenaflor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah thanks, seems like I missed adding this when doing span-streaming 👍

LGTM but I'll let someone else from Java/Android give the final approval

@0xadam-brown

Copy link
Copy Markdown
Member Author

ah thanks, seems like I missed adding this when doing span-streaming 👍

LGTM but I'll let someone else from Java/Android give the final approval

Ah, nw, and it sounds like a lot of others may have missed it too. Apparently the spec wasn't clear prior to Lukas' recent update. Just wanted to make sure you knew about the change 🙌

Prior to this commit, `ClientReportRecorder` didn't have any explicit logic for dealing with span envelopes because sentry-java didn't implement them. That meant that any span envelopes created by hybrid SDKs (in particular sentry-dart) and dropped by sentry-java would be shunted to the recorder's fallback branch and wrongly register a single dropped span per dropped envelope, rather than the actual number.

This commit adds the missing span envelope logic. Now sentry-java will report the actual span count, rather than 1.

Refs [sentry-docs#19854](getsentry/sentry-docs#19854)

# Conflicts:
#	CHANGELOG.md
@0xadam-brown
0xadam-brown force-pushed the fix/client-report-span-item-count branch from d2ca03c to fed4e9a Compare October 16, 2026 13:33
@0xadam-brown 0xadam-brown added the sanity-check PR needs a lightweight review for obvious issues label Oct 16, 2026

This branch has not been deployed

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

Labels

sanity-check PR needs a lightweight review for obvious issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants