Skip to content

Commit 9e3b01d

Browse files
authored
fix(replay): Only set DefaultReplayBreadcrumbConverter if replay is available (#4888)
* Bump Spring Boot 4 to RC2 * Check if replay is available before setting breadcrumbs converter * changelog
1 parent c3e9328 commit 9e3b01d

File tree

8 files changed

+22
-6
lines changed

8 files changed

+22
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- Removed SentryExecutorService limit for delayed scheduled tasks ([#4846](https://github.com/getsentry/sentry-java/pull/4846))
88
- Fix visual artifacts for the Canvas strategy on some devices ([#4861](https://github.com/getsentry/sentry-java/pull/4861))
9+
- Only set `DefaultReplayBreadcrumbConverter` if replay is available ([#4888](https://github.com/getsentry/sentry-java/pull/4888))
910

1011
### Improvements
1112

sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,21 +146,24 @@ static void initializeIntegrationsAndProcessors(
146146
final @NotNull SentryAndroidOptions options,
147147
final @NotNull Context context,
148148
final @NotNull io.sentry.util.LoadClass loadClass,
149-
final @NotNull ActivityFramesTracker activityFramesTracker) {
149+
final @NotNull ActivityFramesTracker activityFramesTracker,
150+
final boolean isReplayAvailable) {
150151
initializeIntegrationsAndProcessors(
151152
options,
152153
context,
153154
new BuildInfoProvider(new AndroidLogger()),
154155
loadClass,
155-
activityFramesTracker);
156+
activityFramesTracker,
157+
isReplayAvailable);
156158
}
157159

158160
static void initializeIntegrationsAndProcessors(
159161
final @NotNull SentryAndroidOptions options,
160162
final @NotNull Context context,
161163
final @NotNull BuildInfoProvider buildInfoProvider,
162164
final @NotNull io.sentry.util.LoadClass loadClass,
163-
final @NotNull ActivityFramesTracker activityFramesTracker) {
165+
final @NotNull ActivityFramesTracker activityFramesTracker,
166+
final boolean isReplayAvailable) {
164167

165168
if (options.getCacheDirPath() != null
166169
&& options.getEnvelopeDiskCache() instanceof NoOpEnvelopeCache) {
@@ -254,8 +257,9 @@ static void initializeIntegrationsAndProcessors(
254257
options.setCompositePerformanceCollector(new DefaultCompositePerformanceCollector(options));
255258
}
256259

257-
if (options.getReplayController().getBreadcrumbConverter()
258-
instanceof NoOpReplayBreadcrumbConverter) {
260+
if (isReplayAvailable
261+
&& options.getReplayController().getBreadcrumbConverter()
262+
instanceof NoOpReplayBreadcrumbConverter) {
259263
options
260264
.getReplayController()
261265
.setBreadcrumbConverter(new DefaultReplayBreadcrumbConverter(options));

sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroid.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,12 @@ public static void init(
171171
}
172172

173173
AndroidOptionsInitializer.initializeIntegrationsAndProcessors(
174-
options, context, buildInfoProvider, loadClass, activityFramesTracker);
174+
options,
175+
context,
176+
buildInfoProvider,
177+
loadClass,
178+
activityFramesTracker,
179+
isReplayAvailable);
175180

176181
deduplicateIntegrations(options, isFragmentAvailable, isTimberAvailable);
177182
},

sentry-android-core/src/test/java/io/sentry/android/core/AndroidContinuousProfilerTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ class AndroidContinuousProfilerTest {
134134
buildInfoProvider,
135135
loadClass,
136136
activityFramesTracker,
137+
false,
137138
)
138139
// Profiler doesn't start if the folder doesn't exists.
139140
// Usually it's generated when calling Sentry.init, but for tests we can create it manually.

sentry-android-core/src/test/java/io/sentry/android/core/AndroidOptionsInitializerTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ class AndroidOptionsInitializerTest {
117117
if (useRealContext) context else mockContext,
118118
loadClass,
119119
activityFramesTracker,
120+
false,
120121
)
121122
}
122123

@@ -162,6 +163,7 @@ class AndroidOptionsInitializerTest {
162163
buildInfo,
163164
loadClass,
164165
activityFramesTracker,
166+
isReplayAvailable,
165167
)
166168
}
167169

sentry-android-core/src/test/java/io/sentry/android/core/AndroidProfilerTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class AndroidProfilerTest {
136136
buildInfoProvider,
137137
loadClass,
138138
activityFramesTracker,
139+
false,
139140
)
140141
// Profiler doesn't start if the folder doesn't exists.
141142
// Usually it's generated when calling Sentry.init, but for tests we can create it manually.

sentry-android-core/src/test/java/io/sentry/android/core/AndroidTransactionProfilerTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ class AndroidTransactionProfilerTest {
152152
buildInfoProvider,
153153
loadClass,
154154
activityFramesTracker,
155+
false,
155156
)
156157
// Profiler doesn't start if the folder doesn't exists.
157158
// Usually it's generated when calling Sentry.init, but for tests we can create it manually.

sentry-android-core/src/test/java/io/sentry/android/core/SentryInitProviderTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ class SentryInitProviderTest {
168168
mockContext,
169169
loadClass,
170170
activityFramesTracker,
171+
false,
171172
)
172173

173174
assertFalse(sentryOptions.isEnableNdk)

0 commit comments

Comments
 (0)