Skip to content

perf(android): Replace RNSentryFrameDelayCollector with sentry-java getFramesDelay API#6074

Draft
antonis wants to merge 2 commits intomainfrom
feat/android-frames-delay-api
Draft

perf(android): Replace RNSentryFrameDelayCollector with sentry-java getFramesDelay API#6074
antonis wants to merge 2 commits intomainfrom
feat/android-frames-delay-api

Conversation

@antonis
Copy link
Copy Markdown
Contributor

@antonis antonis commented Apr 30, 2026

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Replaces the custom RNSentryFrameDelayCollector (listener-based frame delay collector) with a direct call to the new SentryFrameMetricsCollector.getFramesDelay() API added in sentry-java#5248 (commit 61659b6).

Changes:

  • Delete RNSentryFrameDelayCollector.java (~130 lines) — no longer needed
  • Simplify fetchNativeFramesDelay() to call collector.getFramesDelay(startNanos, endNanos) directly
  • Replace custom listener with a no-op listener registration to ensure frame metrics collection stays active
  • Add stopFrameMetricsCollection() helper for clean lifecycle management

💡 Motivation and Context

Closes #5908

The previous implementation in #5907 duplicated work already done internally by sentry-java:

  • Double listener callbacks: Every frame triggered two listener callbacks on the UI thread
  • Double storage: Two separate data structures holding the same per-frame delay records
  • Redundant computation: Both collectors computed delay overlap independently

With sentry-java now exposing a queryable API (mirroring iOS's getFramesDelaySPI), we can eliminate all of this overhead.

⚠️ Blocked on sentry-android SDK bump

This PR requires sentry-android >= next release (> 8.40.0) which includes the getFramesDelay() API and SentryFramesDelayResult class. It will not compile against the current 8.40.0 dependency.

💚 How did you test it?

  • All JS/TS tests pass (yarn test — 1187 tests)
  • Code review of the API surface against sentry-java#5248
  • Will require integration testing once sentry-android is bumped

📝 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
  • No breaking changes

🔮 Next steps

  • Bump sentry-android dependency to the release containing getFramesDelay() API
  • Verify Android compilation and run integration tests
  • Consider removing the no-op listener if sentry-java's auto-instrumentation keeps collection active by default

…etFramesDelay API

Uses the new queryable `SentryFrameMetricsCollector.getFramesDelay()` API
from sentry-java (getsentry/sentry-java#5248, commit 61659b6) instead of
maintaining a custom listener-based collector.

Closes #5908

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

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).


  • perf(android): Replace RNSentryFrameDelayCollector with sentry-java getFramesDelay API by antonis in #6074
  • chore(deps): update JavaScript SDK to v10.51.0 by github-actions in #6071
  • feat(core): Support SENTRY_RELEASE and SENTRY_DIST env vars in build scripts by antonis in #6070
  • test(ios): Add unit tests for RNSentryIsPathUnderAllowedRoots by antonis in #6068
  • test(profiling): pin Android RNSentryStart wiring of _experiments.profilingOptions by antonis in #6060
  • refactor(ios): remove dead SentrySDKWrapper init surface by antonis in #6059
  • chore(deps): update Bundler Plugins to v5.2.1 by github-actions in #6067
  • chore(deps): update CLI to v3.4.1 by github-actions in #6066
  • fix(ci): Grant statuses: write to changelog-preview caller by antonis in #6063
  • fix(android): Use safeExtGet for compileSdkVersion in expo-handler by lucas-zimerman in #6061
  • fix(core): Restrict getDataFromUri native bridge methods by antonis in #6045
  • chore(deps): bump postcss to ^8.5.10 by antonis in #6058
  • ref: Remove enableSessionReplayInUnreliableEnvironment use by itaybre in #6046
  • fix(core): Harden metro dev helpers by antonis in #6044
  • fix(android): Mask auth token in sentry.gradle upload-task log by antonis in #6057
  • fix(tracing): Discard invalid navigation transactions via event processor by alwx in #6051
  • ci: Restore changelog-preview workflow with hardened craft 2.26.2 by antonis in #6056
  • chore(deps): update Maestro to v2.5.0 by github-actions in #6053
  • chore(deps): bump getsentry/craft from 2.25.4 to 2.26.2 by dependabot in #6050
  • chore: Back-merge release/8.9.1 into main by antonis in #6055
  • feat(core): Add rage tap detection with ui.frustration breadcrumbs by alwx in #5992
  • chore(deps): bump fast-xml-parser to ^5.7.0 by antonis in #6043
  • chore(deps): bump @xmldom/xmldom to 0.8.13/0.9.10 by antonis in #6042
  • chore(deps-dev): Remove unused uuid devDependency by antonis in #6041

Plus 4 more


🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request

Generated by 🚫 dangerJS against ea9d0b6

Copy link
Copy Markdown
Contributor Author

@antonis antonis left a comment

Choose a reason for hiding this comment

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

Marking as blocked till an Android bump containing the changes in getsentry/sentry-java#5248 is shipped

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.

perf(android): Replace RNSentryFrameDelayCollector with queryable sentry-java API

1 participant