From 364c8fc8ba11459252ac8c7460ff4b78b36f457d Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 25 Aug 2026 15:25:04 +0200 Subject: [PATCH] test(macrobenchmark): Inject a 20ms init regression to exercise the A/B (JAVA-679) DO NOT MERGE. Throwaway branch whose only purpose is to make the macrobenchmark comparison workflow run against a base that can actually build a baseline, and to give it a known regression to find. Sleeps 20ms inside the SentryAndroid.init trace section. The expected result is roughly +20ms on the SentryAndroid.init metric with a p near zero, and a much less certain move on timeToInitialDisplay, since whole-start noise swamps a change that size. That contrast is the reason the trace-section metric exists. --- .../java/io/sentry/android/core/SentryAndroid.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroid.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroid.java index ab18a5827b..ce0d197580 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroid.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroid.java @@ -99,6 +99,16 @@ public static void init( // Started before acquiring the lock so it stays balanced with the endSection() in the finally // even if acquire() throws. Trace.beginSection("SentryAndroid.init"); + // --------------------------------------------------------------------------------------- + // DO NOT MERGE. Deliberate 20ms regression, inside the traced section, to prove the + // macrobenchmark A/B harness detects a known change and attributes it to the right metric. + // This branch exists only to exercise that workflow and must never reach main. + // --------------------------------------------------------------------------------------- + try { + Thread.sleep(20); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } try (final @NotNull ISentryLifecycleToken ignored = staticLock.acquire()) { Sentry.init( new SentryAndroidOptionsContainer(),