Skip to content

Commit

Permalink
(Android) Enable Performance V2 by default (#3824)
Browse files Browse the repository at this point in the history
* enablePerformanceV2 is now true by default, and is no longer experimental
added changelog entry
  • Loading branch information
stefanosiano authored Oct 28, 2024
1 parent 83e1bd2 commit d590d3e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
- `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`.
- 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.

### Behavioural Changes

- (Android) Enable Performance V2 by default ([#3824](https://github.com/getsentry/sentry-java/pull/3824))
- With this change cold app start spans will include spans for ContentProviders, Application and Activity load.

## 8.0.0-beta.1

### Breaking Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public interface BeforeCaptureCallback {
*/
private boolean attachAnrThreadDump = false;

private boolean enablePerformanceV2 = false;
private boolean enablePerformanceV2 = true;

private @Nullable SentryFrameMetricsCollector frameMetricsCollector;

Expand Down Expand Up @@ -555,20 +555,18 @@ public void setAttachAnrThreadDump(final boolean attachAnrThreadDump) {
* @return true if performance-v2 is enabled. See {@link #setEnablePerformanceV2(boolean)} for
* more details.
*/
@ApiStatus.Experimental
public boolean isEnablePerformanceV2() {
return enablePerformanceV2;
}

/**
* Experimental: Enables or disables the Performance V2 SDK features.
* Enables or disables the Performance V2 SDK features.
*
* <p>With this change - Cold app start spans will provide more accurate timings - Cold app start
* spans will be enriched with detailed ContentProvider, Application and Activity startup times
*
* @param enablePerformanceV2 true if enabled or false otherwise
*/
@ApiStatus.Experimental
public void setEnablePerformanceV2(final boolean enablePerformanceV2) {
this.enablePerformanceV2 = enablePerformanceV2;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1185,14 +1185,14 @@ class ManifestMetadataReaderTest {
@Test
fun `applyMetadata reads performance-v2 flag to options`() {
// Arrange
val bundle = bundleOf(ManifestMetadataReader.ENABLE_PERFORMANCE_V2 to true)
val bundle = bundleOf(ManifestMetadataReader.ENABLE_PERFORMANCE_V2 to false)
val context = fixture.getContext(metaData = bundle)

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

// Assert
assertTrue(fixture.options.isEnablePerformanceV2)
assertFalse(fixture.options.isEnablePerformanceV2)
}

@Test
Expand All @@ -1204,7 +1204,7 @@ class ManifestMetadataReaderTest {
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)

// Assert
assertFalse(fixture.options.isEnablePerformanceV2)
assertTrue(fixture.options.isEnablePerformanceV2)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,16 @@ class SentryAndroidOptionsTest {
}

@Test
fun `performance v2 is disabled by default`() {
fun `performance v2 is enabled by default`() {
val sentryOptions = SentryAndroidOptions()
assertFalse(sentryOptions.isEnablePerformanceV2)
assertTrue(sentryOptions.isEnablePerformanceV2)
}

@Test
fun `performance v2 can be enabled`() {
fun `performance v2 can be disabled`() {
val sentryOptions = SentryAndroidOptions()
sentryOptions.isEnablePerformanceV2 = true
assertTrue(sentryOptions.isEnablePerformanceV2)
sentryOptions.isEnablePerformanceV2 = false
assertFalse(sentryOptions.isEnablePerformanceV2)
}

fun `when options is initialized, enableScopeSync is enabled by default`() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class AndroidEnvelopeCacheTest {
AppStartMetrics.getInstance().apply {
if (options.isEnablePerformanceV2) {
appStartTimeSpan.setStartedAt(appStartMillis)
sdkInitTimeSpan.setStartedAt(appStartMillis)
} else {
sdkInitTimeSpan.setStartedAt(appStartMillis)
}
Expand Down

0 comments on commit d590d3e

Please sign in to comment.