Skip to content

feat(samples): Make Nav3 sample app performance runs scriptable and measure the SDK cost - #6812

Merged
0xadam-brown merged 7 commits into
mainfrom
feat/nav3-perf-harness
Nov 30, 2026
Merged

0xadam-brown merged 7 commits into
mainfrom
feat/nav3-perf-harness

Conversation

@0xadam-brown

@0xadam-brown 0xadam-brown commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

📜 Description

Improves the Nav3 sample's Performance tab so its runs can be scripted and more clearly display where CPU cycles and memory are being allocated. For instance, now we can:

  1. Start runs from adb with intent extras. Results are logged to logcat.
  2. Time SentryNavEffect directly (p50 and p90).
  3. Report live heap before and after each run, and after Sentry.flush.
  4. Count transactions dropped because the send queue is full.
  5. Reset the counters when a mode changes.

To start runs from adb, use:

adb shell am start -n io.sentry.samples.android/io.sentry.samples.android.navigation.nav3.Nav3Activity \
  --es nav3_perf_preset capture_1_of_100 --es nav3_perf_run ab_comparison

💡 Motivation and Context

Prior to this PR, the "Performance" tab didn't show where the SDK's time and memory allocations went. Now we can see what's happening.

💚 How did you test it?

  • Had my clanker exercise the Nav3 sample app

Example A/B result:

Side SentryNavEffect Heap before → after After flush Dropped
Disabled — 4.3 → 5.3 MB 5.3 MB 0
Full stack p50 1.35 ms, p90 2.82 ms 4.2 → 6.6 MB 4.2 MB 40 of 100

📝 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

🤖 Generated with Claude Code

#skip-changelog

0xadam-brown and others added 4 commits November 30, 2026 09:07
A run needed UI automation through MainActivity, Integrations, Nav3 setup and the
Performance tab, because Nav3Activity wasn't exported. Export it and read the preset,
integration mode and run from intent extras, so runs can be scripted with
adb shell am start and their results read from logcat.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rmance tab

First draw lands on two 60 Hz frames, so it can't show the SDK's sub-frame cost.
Time the SDK's synchronous back stack work directly, between effects placed before and
after SentryNavEffect, and report its p50 and p90.

Also measure 100 iterations instead of 20, report p90 for both sides of the A/B
comparison, report live heap after a GC before and after each measured run, and show
extractor averages below 1 us instead of truncating them to 0 us.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changing the integration mode, extractor cost or argument shape kept the counters, so
the panel mixed measurements from the old mode with the new one. Reset them, as a run
already does before it measures.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…3 runs

A burst of navigations fills the SDK's send queue, so the after-run heap reading
mostly measured envelopes waiting to be sent, and dropped transactions went
unreported. Count transactions dropped for queue overflow through onDiscard,
then flush and read the heap again after each measured run. In an A/B run, the
flush also gives the second side an empty queue.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit d4c372f.

The model rated this change low. It was raised to medium because:

  • R7: the model was not confident enough that the change is low

This label is a hint for reviewers, not an approval.

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against d4c372f

@sentry

sentry Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

@0xadam-brown 0xadam-brown changed the title feat(samples): Make Nav3 performance runs scriptable and measure the SDK cost feat(samples): Make Nav3 sample app performance runs scriptable and measure the SDK cost Nov 30, 2026
@0xadam-brown 0xadam-brown added the ship-it PR is ready to merge from a reviewer perspective label Nov 30, 2026
@0xadam-brown
0xadam-brown marked this pull request as ready for review November 30, 2026 10:38
@0xadam-brown
0xadam-brown requested review from a team and adinauer as code owners November 30, 2026 10:38
@0xadam-brown
0xadam-brown requested review from romtsn and runningcode and removed request for a team November 30, 2026 10:38
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 30, 2026
@0xadam-brown
0xadam-brown enabled auto-merge (squash) November 30, 2026 11:21
0xadam-brown and others added 2 commits November 30, 2026 12:28
…is cancelled

Leaving the Performance tab while an adb-requested preset warms up cancels the
preset, but the launch code still started the run, on whichever scenario was
open. prepareNav3PerformancePreset now returns whether it finished, and the
launch code stops if it didn't.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Selecting the Performance tab during a run reset its back stack and counters but
let the run continue, so the run finished with partial measurements. Stop the
run whenever a scenario is selected, as other tabs already did.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 30, 2026
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 30, 2026
@0xadam-brown
0xadam-brown merged commit 1c7b8b8 into main Nov 30, 2026
38 checks passed
@0xadam-brown
0xadam-brown deleted the feat/nav3-perf-harness branch November 30, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium ship-it PR is ready to merge from a reviewer perspective

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants