Skip to content

Commit

Permalink
Merge pull request #20734 from wordpress-mobile/enable_performance_pr…
Browse files Browse the repository at this point in the history
…ofiling

Profile every 100th performance transaction
  • Loading branch information
wzieba authored May 1, 2024
2 parents f0081cb + a8d0482 commit 1b68b1c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 0 additions & 2 deletions WordPress/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1148,8 +1148,6 @@
android:label="@string/site_monitoring"
android:theme="@style/WordPress.NoActionBar"/>

<meta-data android:name="io.sentry.traces.activity.enable" android:value="false" />

</application>
<queries>
<intent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ class WPPerformanceMonitoringConfig @Inject constructor(
return when {
hasUserOptedOut || buildConfigWrapper.isDebug() -> PerformanceMonitoringConfig.Disabled
sampleRate <= 0.0 || sampleRate > 1.0 -> PerformanceMonitoringConfig.Disabled
else -> PerformanceMonitoringConfig.Enabled(sampleRate)
else -> PerformanceMonitoringConfig.Enabled(
sampleRate = sampleRate,
profilesSampleRate = RELATIVE_PROFILES_SAMPLE_RATE
)
}
}

companion object {
const val RELATIVE_PROFILES_SAMPLE_RATE = 0.01
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper
import org.assertj.core.api.Assertions.assertThat
import org.mockito.kotlin.mock
import org.wordpress.android.util.config.RemoteConfigWrapper
import org.wordpress.android.util.crashlogging.WPPerformanceMonitoringConfig.Companion.RELATIVE_PROFILES_SAMPLE_RATE

private const val VALID_SAMPLE_RATE = 0.01
private const val INVALID_SAMPLE_RATE = 0.0
Expand Down Expand Up @@ -49,7 +50,12 @@ class WPPerformanceMonitoringConfigTest {

val result = sut.invoke()

assertThat(result).isEqualTo(PerformanceMonitoringConfig.Enabled(VALID_SAMPLE_RATE))
assertThat(result).isEqualTo(
PerformanceMonitoringConfig.Enabled(
VALID_SAMPLE_RATE,
RELATIVE_PROFILES_SAMPLE_RATE
)
)
}

@Test
Expand Down

0 comments on commit 1b68b1c

Please sign in to comment.