Skip to content

Commit d590d3e

Browse files
authored
(Android) Enable Performance V2 by default (#3824)
* enablePerformanceV2 is now true by default, and is no longer experimental added changelog entry
1 parent 83e1bd2 commit d590d3e

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
- `globalHubMode` used to only be a param on `Sentry.init`. To make it easier to be used in e.g. Desktop environments, we now additionally added it as an option on SentryOptions that can also be set via `sentry.properties`.
99
- If both the param on `Sentry.init` and the option are set, the option will win. By default the option is set to `null` meaning whatever is passed to `Sentry.init` takes effect.
1010

11+
### Behavioural Changes
12+
13+
- (Android) Enable Performance V2 by default ([#3824](https://github.com/getsentry/sentry-java/pull/3824))
14+
- With this change cold app start spans will include spans for ContentProviders, Application and Activity load.
15+
1116
## 8.0.0-beta.1
1217

1318
### Breaking Changes

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public interface BeforeCaptureCallback {
206206
*/
207207
private boolean attachAnrThreadDump = false;
208208

209-
private boolean enablePerformanceV2 = false;
209+
private boolean enablePerformanceV2 = true;
210210

211211
private @Nullable SentryFrameMetricsCollector frameMetricsCollector;
212212

@@ -555,20 +555,18 @@ public void setAttachAnrThreadDump(final boolean attachAnrThreadDump) {
555555
* @return true if performance-v2 is enabled. See {@link #setEnablePerformanceV2(boolean)} for
556556
* more details.
557557
*/
558-
@ApiStatus.Experimental
559558
public boolean isEnablePerformanceV2() {
560559
return enablePerformanceV2;
561560
}
562561

563562
/**
564-
* Experimental: Enables or disables the Performance V2 SDK features.
563+
* Enables or disables the Performance V2 SDK features.
565564
*
566565
* <p>With this change - Cold app start spans will provide more accurate timings - Cold app start
567566
* spans will be enriched with detailed ContentProvider, Application and Activity startup times
568567
*
569568
* @param enablePerformanceV2 true if enabled or false otherwise
570569
*/
571-
@ApiStatus.Experimental
572570
public void setEnablePerformanceV2(final boolean enablePerformanceV2) {
573571
this.enablePerformanceV2 = enablePerformanceV2;
574572
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,14 +1185,14 @@ class ManifestMetadataReaderTest {
11851185
@Test
11861186
fun `applyMetadata reads performance-v2 flag to options`() {
11871187
// Arrange
1188-
val bundle = bundleOf(ManifestMetadataReader.ENABLE_PERFORMANCE_V2 to true)
1188+
val bundle = bundleOf(ManifestMetadataReader.ENABLE_PERFORMANCE_V2 to false)
11891189
val context = fixture.getContext(metaData = bundle)
11901190

11911191
// Act
11921192
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)
11931193

11941194
// Assert
1195-
assertTrue(fixture.options.isEnablePerformanceV2)
1195+
assertFalse(fixture.options.isEnablePerformanceV2)
11961196
}
11971197

11981198
@Test
@@ -1204,7 +1204,7 @@ class ManifestMetadataReaderTest {
12041204
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)
12051205

12061206
// Assert
1207-
assertFalse(fixture.options.isEnablePerformanceV2)
1207+
assertTrue(fixture.options.isEnablePerformanceV2)
12081208
}
12091209

12101210
@Test

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,16 @@ class SentryAndroidOptionsTest {
151151
}
152152

153153
@Test
154-
fun `performance v2 is disabled by default`() {
154+
fun `performance v2 is enabled by default`() {
155155
val sentryOptions = SentryAndroidOptions()
156-
assertFalse(sentryOptions.isEnablePerformanceV2)
156+
assertTrue(sentryOptions.isEnablePerformanceV2)
157157
}
158158

159159
@Test
160-
fun `performance v2 can be enabled`() {
160+
fun `performance v2 can be disabled`() {
161161
val sentryOptions = SentryAndroidOptions()
162-
sentryOptions.isEnablePerformanceV2 = true
163-
assertTrue(sentryOptions.isEnablePerformanceV2)
162+
sentryOptions.isEnablePerformanceV2 = false
163+
assertFalse(sentryOptions.isEnablePerformanceV2)
164164
}
165165

166166
fun `when options is initialized, enableScopeSync is enabled by default`() {

sentry-android-core/src/test/java/io/sentry/android/core/cache/AndroidEnvelopeCacheTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class AndroidEnvelopeCacheTest {
5151
AppStartMetrics.getInstance().apply {
5252
if (options.isEnablePerformanceV2) {
5353
appStartTimeSpan.setStartedAt(appStartMillis)
54+
sdkInitTimeSpan.setStartedAt(appStartMillis)
5455
} else {
5556
sdkInitTimeSpan.setStartedAt(appStartMillis)
5657
}

0 commit comments

Comments
 (0)