Skip to content

feat(replay): Record segment names (transaction names)#5763

Open
sentry-junior[bot] wants to merge 8 commits into
mainfrom
feat/replay-segment-names
Open

feat(replay): Record segment names (transaction names)#5763
sentry-junior[bot] wants to merge 8 commits into
mainfrom
feat/replay-segment-names

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Note: Sentry is moving away from the concept of transactions and instead calls them now segments.

Record transaction segment names on replay events so replays can be queried by the named transaction that occurred during each segment.

This is needed in Sentry Flutter to report segment names that occurred during replays. (getsentry/sentry-dart#3865)

Replay context

Adds ReplayController.registerSegmentName, collects unique names alongside trace IDs with the same 100-value limit, and clears both collections when a replay segment is created. Successfully captured native transactions register their transaction name automatically.

Payload

Replay events now serialize and deserialize the collected names as segment_names, with coverage for protocol round trips, deduplication, limits, and per-segment clearing.

Related work in Sentry Javascript getsentry/sentry-javascript#21851

Requested by Gino Buenaflor via Junior.

--

View Junior Session in Sentry

Co-Authored-By: Gino Buenaflor <giancarlo.buenaflor@sentry.io>
@github-actions

github-actions Bot commented Jul 15, 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 10acd25

@buenaflor buenaflor changed the title feat(replay): Record segment names feat(replay): Record segment names (transaction names) Jul 15, 2026
@sentry

sentry Bot commented Jul 15, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

sentry-junior Bot and others added 2 commits July 15, 2026 10:45
Co-Authored-By: Gino Buenaflor <giancarlo.buenaflor@sentry.io>
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 321.36 ms 376.41 ms 55.05 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
6b019b7 403.90 ms 546.09 ms 142.19 ms
e63ad34 310.20 ms 366.84 ms 56.63 ms
5865051 319.74 ms 365.60 ms 45.86 ms
a1eadfa 345.67 ms 411.26 ms 65.59 ms
b193867 319.59 ms 403.09 ms 83.50 ms
0eaac1e 316.82 ms 357.34 ms 40.52 ms
22ff2c7 306.60 ms 336.65 ms 30.05 ms
d15471f 286.65 ms 314.68 ms 28.03 ms
05aa61d 310.43 ms 372.40 ms 61.97 ms
fcec2f2 311.35 ms 384.94 ms 73.59 ms

App size

Revision Plain With Sentry Diff
6b019b7 0 B 0 B 0 B
e63ad34 0 B 0 B 0 B
5865051 0 B 0 B 0 B
a1eadfa 0 B 0 B 0 B
b193867 1.58 MiB 2.19 MiB 620.00 KiB
0eaac1e 1.58 MiB 2.19 MiB 619.17 KiB
22ff2c7 0 B 0 B 0 B
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
05aa61d 0 B 0 B 0 B
fcec2f2 1.58 MiB 2.12 MiB 551.51 KiB

Previous results on branch: feat/replay-segment-names

Startup times

Revision Plain With Sentry Diff
6a556d4 360.77 ms 417.23 ms 56.46 ms

App size

Revision Plain With Sentry Diff
6a556d4 0 B 0 B 0 B

sentry-junior Bot and others added 2 commits July 15, 2026 11:22
Co-Authored-By: Gino Buenaflor <giancarlo.buenaflor@sentry.io>
@buenaflor buenaflor marked this pull request as ready for review July 15, 2026 11:31
@buenaflor buenaflor requested a review from adinauer as a code owner July 15, 2026 11:31
Copilot AI review requested due to automatic review settings July 15, 2026 11:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds support for recording segment names (transaction names) in Session Replay so replay events can be queried by the named segment(s) that occurred during each replay segment.

Changes:

  • Extend the ReplayController API with registerSegmentName, and register transaction names from SentryClient.captureTransaction.
  • Persist segment names in SentryReplayEvent payloads as segment_names (including serialization/deserialization support).
  • Track, deduplicate, cap (100), and clear segment names per replay segment in the Android replay capture strategies, with added tests.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sentry/src/test/resources/json/sentry_replay_event.json Updates replay event golden JSON to include segment_names.
sentry/src/test/java/io/sentry/SentryClientTest.kt Adds/updates tests to verify segment name registration via ReplayController.
sentry/src/test/java/io/sentry/protocol/SentryReplayEventSerializationTest.kt Ensures replay event protocol round-trip includes segmentNames.
sentry/src/main/java/io/sentry/SentryReplayEvent.java Adds segmentNames field with JSON key segment_names plus (de)serialization and equality updates.
sentry/src/main/java/io/sentry/SentryClient.java Registers captured transaction name with replay controller when a transaction is successfully sent.
sentry/src/main/java/io/sentry/ReplayController.java Adds new internal API hook registerSegmentName.
sentry/src/main/java/io/sentry/NoOpReplayController.java Implements the new no-op registerSegmentName method.
sentry/api/sentry.api Updates public API dump for ReplayController, NoOpReplayController, and SentryReplayEvent.
sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt Adds tests for deduplication, limit, and per-segment clearing of segment names.
sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt Forwards registerSegmentName to the active capture strategy when recording.
sentry-android-replay/src/main/java/io/sentry/android/replay/capture/CaptureStrategy.kt Extends internal replay segment creation flow to include segmentNames.
sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt Implements collection/dedup/limit/clear logic for segment names alongside trace IDs.
sentry-android-replay/api/sentry-android-replay.api Updates Android replay module API dump for ReplayIntegration.
CHANGELOG.md Adds an unreleased changelog entry for the new replay segment name capability.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CHANGELOG.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

3 participants