Skip to content

Commit a33339c

Browse files
authored
fix(replay): Inconsistent segment_id (#4471)
1 parent e53e3d1 commit a33339c

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
- Send UI Profiling app start chunk when it finishes ([#4423](https://github.com/getsentry/sentry-java/pull/4423))
88
- Republish Javadoc [#4457](https://github.com/getsentry/sentry-java/pull/4457)
99
- Finalize `OkHttpEvent` even if no active span in `SentryOkHttpInterceptor` [#4469](https://github.com/getsentry/sentry-java/pull/4469)
10-
- Correctly capture Dialogs and non full-sized windows ([#4354](https://github.com/getsentry/sentry-java/pull/4354))
10+
- Session Replay: Correctly capture Dialogs and non full-sized windows ([#4354](https://github.com/getsentry/sentry-java/pull/4354))
11+
- Session Replay: Fix inconsistent `segment_id` ([#4471](https://github.com/getsentry/sentry-java/pull/4471))
1112

1213
## 8.13.2
1314

sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ internal abstract class BaseCaptureStrategy(
107107

108108
override fun stop() {
109109
cache?.close()
110-
currentSegment = -1
111110
replayStartTimestamp.set(0)
112111
segmentTimestamp = null
113112
currentReplayId = SentryId.EMPTY_ID

sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BufferCaptureStrategy.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ internal class BufferCaptureStrategy(
5757
val replayCacheDir = cache?.replayCacheDir
5858
replayExecutor.submitSafely(options, "$TAG.stop") {
5959
FileUtils.deleteRecursively(replayCacheDir)
60+
currentSegment = -1
6061
}
6162
super.stop()
6263
}
@@ -205,7 +206,6 @@ internal class BufferCaptureStrategy(
205206
} else {
206207
DateUtils.getDateTime(now - errorReplayDuration)
207208
}
208-
val segmentId = currentSegment
209209
val duration = now - currentSegmentTimestamp.time
210210
val replayId = currentReplayId
211211

@@ -215,7 +215,7 @@ internal class BufferCaptureStrategy(
215215
duration,
216216
currentSegmentTimestamp,
217217
replayId,
218-
segmentId,
218+
currentSegment,
219219
currentConfig.recordingHeight,
220220
currentConfig.recordingWidth,
221221
currentConfig.frameRate,

sentry-android-replay/src/main/java/io/sentry/android/replay/capture/SessionCaptureStrategy.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ internal class SessionCaptureStrategy(
5959
if (segment is ReplaySegment.Created) {
6060
segment.capture(scopes)
6161
}
62+
currentSegment = -1
6263
FileUtils.deleteRecursively(replayCacheDir)
6364
}
6465
scopes?.configureScope { it.replayId = SentryId.EMPTY_ID }
@@ -159,7 +160,6 @@ internal class SessionCaptureStrategy(
159160

160161
val now = dateProvider.currentTimeMillis
161162
val currentSegmentTimestamp = segmentTimestamp ?: return
162-
val segmentId = currentSegment
163163
val duration = now - currentSegmentTimestamp.time
164164
val replayId = currentReplayId
165165
replayExecutor.submitSafely(options, "$TAG.$taskName") {
@@ -168,7 +168,7 @@ internal class SessionCaptureStrategy(
168168
duration,
169169
currentSegmentTimestamp,
170170
replayId,
171-
segmentId,
171+
currentSegment,
172172
currentConfig.recordingHeight,
173173
currentConfig.recordingWidth,
174174
currentConfig.frameRate,

0 commit comments

Comments
 (0)