Skip to content

[DO NOT MERGE] Strip Android 17 trace header keys unknown to Relay - #6892

Closed
antonis wants to merge 1 commit into
mainfrom
experiment/android17-trace-header-strip
Closed

antonis wants to merge 1 commit into
mainfrom
experiment/android17-trace-header-strip

Conversation

@antonis

@antonis antonis commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Caution

Do not merge. This is a reference experiment for a Relay issue, not a fix we intend to ship. The proper fix belongs in Relay.

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Transaction profiles recorded on Android 17 (API 37) are dropped at ingestion with outcome invalid / profiling_invalid_sampled_profile. The same build on Android 16 (API 36) is accepted. In Stats this shows as "Invalid · Internal", because getReasonGroupName.ts groups every profiling_* reason under "Internal".

Cause: Android 17's ART method trace (Debug.startMethodTracingSampling) adds new header lines to the *version section:

pid=4471
is_streaming=false          ← new
is_precise_trace=true       ← new
end_time=1642106300035      ← new
end_tsc=7762889077040       ← new
compilation-filter=run-from-apk   ← new
*threads

Relay decodes sampled_profile with android_trace_log 0.3.0 (relay-profiling/src/android/legacy.rs:138, and chunk.rs:100 for trace chunks). That parser's header loop only accepts ten known keys and fails on the first unknown one.

This PR: right before the trace is base64-encoded in stopProfiling(), it drops key=value lines whose key is unknown to that parser. Only the *version section is touched; the input is returned unchanged when there's nothing to drop. Everything is prefixed TEMP.

💡 Motivation and Context

Reference for the Relay issue: it proves that the new header keys are the only incompatibility, and that skipping unknown header keys is enough.

  • With this change, an Android 17 profile is accepted (03d14df40eec40538c7b67de18d8fcb6, org sentry-sdks, project 5428561), where every Android 17 profile without it was rejected (33 on 2026-10-15).
  • A Python port of the android_trace_log grammar parses 15/15 Android 17 traces fully once unknown header keys are skipped: binary v3, event_size=14, dual clock, all events consumed, 0 trailing bytes.

Suggested Relay fix: same transformation server-side, restricted to unknown keys so malformed known keys still fail as today. It's byte-identical for current traces, and it fixes all SDKs and already-shipped apps.

Related: #6891, whose Android CPU/memory measurements could only be verified on API ≤ 36 because of this.

💚 How did you test it?

  • Sample app on an Android 17 (API 37) emulator: the log confirms the five lines were stripped, and the profile was ingested and loads in the UI.
  • Without the change, the same setup gives profiling_invalid_sampled_profile (stats_v2?groupBy=reason).

📝 Checklist

  • I added tests to verify 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.
  • All tests passing.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.
  • No breaking changes.

🔮 Next steps

  • File the Relay issue and link it here.
  • Close this PR once Relay handles unknown header keys (or turn it into a proper client-side workaround if Relay's fix will take long).

🤖 Generated with Claude Code

…nown to Relay

Reference experiment for a Relay issue. Android 17 (API 37) ART method
traces add header lines (is_streaming, is_precise_trace, end_time,
end_tsc, compilation-filter) that Relay's android_trace_log 0.3.0 parser
rejects, so Android 17 transaction profiles are dropped as
profiling_invalid_sampled_profile. Removing only those lines before
upload makes the profiles ingest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

⚪ None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • [DO NOT MERGE] Strip Android 17 trace header keys unknown to Relay by antonis in #6892
  • fix(core): Deduplicate native HTTP breadcrumbs for URLs with a query string by antonis in #6881
  • fix(android): Include CPU and memory measurements in Android profiles by antonis in #6891
  • chore(deps): update Cocoa SDK to v9.30.2 by github-actions in #6888
  • test(e2e): iOS crash-handler screenshot no-freeze regression check by antonis in #6839
  • fix(replay): Attach Session Replay buffer to user feedback by antonis in #6870
  • chore(deps): update Android SDK to v8.61.0 by github-actions in #6889
  • chore(deps): bump futureware-tech/simulator-action from 5 to 6 by dependabot in #6878
  • chore(deps): bump getsentry/craft from 2.33.1 to 2.34.1 by dependabot in #6880
  • chore(deps): bump actions/download-artifact from 8.0.1 to 8.0.2 by dependabot in #6879
  • chore(deps): bump ruby/setup-ruby from 1.327.0 to 1.328.0 by dependabot in #6877
  • chore(deps): bump the codeql-action group with 3 updates by dependabot in #6876
  • build(deps): Pin tinypool to patched 2.x to resolve prototype-pollution advisories by antonis in #6869
  • build(deps): Bump sharp, shell-quote and smol-toml to patched versions by antonis in #6868
  • fix(core): Do not mark sendDefaultPii as deprecated in React Native options by alwx in #6864
  • ci(ios): Archive the SwiftPM app to catch xcframework signature collisions by alwx in #6871
  • feat(core): Support applicationKey and moduleMetadata in Metro config by alwx in #6863
  • chore(deps): update JavaScript SDK to v10.76.2 by antonis in #6866
  • ci(core): Guard the "sideEffects": false contract with a lint check by antonis in #6836
  • chore(deps): bump nx from 22.7.7 to 22.7.12 by dependabot in #6857
  • chore(deps): bump compression from 1.7.5 to 1.8.2 by dependabot in #6856
  • chore(deps): bump postcss-selector-parser from 7.1.4 to 7.1.6 by dependabot in #6855
  • chore(deps): bump source-map-js from 1.2.1 to 1.2.2 by dependabot in #6854
  • chore(deps): bump proxy-addr from 2.0.7 to 2.0.8 by dependabot in #6853

Plus 2 more


🤖 This preview updates automatically when you update the PR.

@github-actions

Copy link
Copy Markdown
Contributor
Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request
🚫 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

- [DO NOT MERGE] Strip Android 17 trace header keys unknown to Relay ([#6892](https://github.com/getsentry/sentry-react-native/pull/6892))

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 6509ceb

@antonis antonis left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Closing as it served the purpose of testing

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant