Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
7a7d63f
feat(extend-app-start): Add IAppStartExtender bridge and SentryOptionโ€ฆ
buenaflor Jun 23, 2026
313fff1
chore(extend-app-start): Annotate NoOpAppStartExtender internal and fโ€ฆ
buenaflor Jun 23, 2026
540931a
refactor(extend-app-start): Rename finishAppStart to finishExtendedApโ€ฆ
buenaflor Jun 25, 2026
7dfe617
feat(extend-app-start): Extract AppStartExtension component for the Aโ€ฆ
buenaflor Jun 23, 2026
4d0c97d
refactor(extend-app-start): Inject logger into AppStartExtension instโ€ฆ
buenaflor Jun 25, 2026
b5ac7f5
refactor(extend-app-start): Return ExtendedAppStart from the listenerโ€ฆ
buenaflor Jun 25, 2026
81efded
chore(extend-app-start): Remove redundant comments and rename reset tโ€ฆ
buenaflor Jun 25, 2026
3cc743e
refactor(extend-app-start): Inline the logger lookup instead of injecโ€ฆ
buenaflor Jun 25, 2026
1dafb9b
chore(extend-app-start): Drop the class and listener javadocs on AppSโ€ฆ
buenaflor Jun 25, 2026
8548b4d
chore(extend-app-start): Trim finishTransaction/getExtendedEndTime coโ€ฆ
buenaflor Jun 25, 2026
01b1dc4
refactor(extend-app-start): Rename AppStartExtension.finishAppStart tโ€ฆ
buenaflor Jun 25, 2026
d996425
feat(extend-app-start): Eagerly create the extended App Start transacโ€ฆ
buenaflor Jun 24, 2026
4349a42
feat(extend-app-start): Add public Sentry app start extension API
buenaflor Jun 25, 2026
51e4969
chore(extend-app-start): Drop the redundant foreground-check comment โ€ฆ
buenaflor Jun 25, 2026
4c1f0d7
test(extend-app-start): Replace the no-op finish test with isExtendedโ€ฆ
buenaflor Jun 25, 2026
48bb3a1
test(extend-app-start): Drop the no-value getAppStartExtension test aโ€ฆ
buenaflor Jun 25, 2026
05a9df2
chore(extend-app-start): Drop the redundant foreground-check comment โ€ฆ
buenaflor Jun 25, 2026
5830303
test(extend-app-start): Drop the no-value getAppStartExtension test aโ€ฆ
buenaflor Jun 25, 2026
ec4da6c
test(extend-app-start): Drop the no-op finishExtendedAppStart test
buenaflor Jun 25, 2026
9fa64fd
Merge branch 'feat/app-start-extension-android' into feat/app-start-eโ€ฆ
buenaflor Jun 25, 2026
2e102d1
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 25, 2026
38f83e1
chore(extend-app-start): Trim and de-duplicate comments in the eager โ€ฆ
buenaflor Jun 25, 2026
79a77d1
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 25, 2026
55decba
chore(extend-app-start): Clarify the extensionActive comment
buenaflor Jun 25, 2026
d72cf0f
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 25, 2026
0a167ee
feat(extend-app-start): Show extending the app start in the Android sโ€ฆ
buenaflor Jun 25, 2026
d2c16a2
fix(extend-app-start): Read the extended span finish date, not its fiโ€ฆ
buenaflor Jun 25, 2026
f0a85b0
Merge branch 'feat/app-start-extension-android' into feat/app-start-eโ€ฆ
buenaflor Jun 25, 2026
6ca5f2b
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 25, 2026
b6dd76e
fix(extend-app-start): End the extended transaction at the extended sโ€ฆ
buenaflor Jun 25, 2026
66cd87d
Merge branch 'feat/app-start-extension-android' into feat/app-start-eโ€ฆ
buenaflor Jun 25, 2026
b1cc115
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 25, 2026
571416e
ref(extend-app-start): Rename extended app start span op to app.startโ€ฆ
buenaflor Jun 25, 2026
caa7945
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 25, 2026
ff8c056
fix(extend-app-start): Guard extendAppStartListener with the lock
buenaflor Jun 26, 2026
b4f34ce
Merge branch 'feat/app-start-extension-android' into feat/app-start-eโ€ฆ
buenaflor Jun 26, 2026
d480039
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 26, 2026
1eb12d5
fix(extend-app-start): Fix headless app start end time and duplicate txn
buenaflor Jun 26, 2026
7f41597
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 26, 2026
b5bf4ec
style(extend-app-start): Trim low-value comments in the headless fix
buenaflor Jun 26, 2026
c94e761
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 26, 2026
bb88dad
style(extend-app-start): Drop redundant extend-listener comment
buenaflor Jun 26, 2026
f4756cb
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 26, 2026
85e23d8
style(extend-app-start): Trim redundant comments in onActivityCreated
buenaflor Jun 26, 2026
ef85bb6
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 26, 2026
f2d1c34
style(extend-app-start): Remove explanatory comments in app start paths
buenaflor Jun 26, 2026
ca33abd
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 26, 2026
d2df48b
fix(extend-app-start): Consume stored app start trace on the extensioโ€ฆ
buenaflor Jun 26, 2026
5207bb6
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 26, 2026
142a9d2
fix(extend-app-start): Only the launch activity attaches the app starโ€ฆ
buenaflor Jun 26, 2026
21a6103
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 26, 2026
dd7b3e0
Format code
getsentry-bot Jun 26, 2026
0c27a47
Format code
getsentry-bot Jun 26, 2026
e26ee97
style(extend-app-start): Trim verbose finishTransaction comment
buenaflor Jun 26, 2026
b7da10f
Merge branch 'feat/app-start-extension-android' into feat/app-start-eโ€ฆ
buenaflor Jun 26, 2026
0de722b
style(extend-app-start): Trim verbose comments in app start paths
buenaflor Jun 26, 2026
c2cdb14
Merge remote-tracking branch 'origin/feat/app-start-extension-materiaโ€ฆ
buenaflor Jun 26, 2026
3476145
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 26, 2026
83e2058
fix(extend-app-start): Read finish date in getExtendedAppStartSpan
buenaflor Jun 29, 2026
2a02616
Merge branch 'feat/app-start-extension-android' into feat/app-start-eโ€ฆ
buenaflor Jun 29, 2026
ff1a826
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 29, 2026
53cf7db
style(extend-app-start): Trim duplicated reentrancy comment in getExtโ€ฆ
buenaflor Jun 29, 2026
11d704d
style(extend-app-start): Keep trimmed reentrancy comment within line โ€ฆ
buenaflor Jun 29, 2026
df8cfe4
Merge branch 'feat/app-start-extension-android' into feat/app-start-eโ€ฆ
buenaflor Jun 29, 2026
b442c1e
style(extend-app-start): Drop two line-narrating test comments
buenaflor Jun 29, 2026
1138f81
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 29, 2026
dc76d9a
style(extend-app-start): Reword getExtendedAppStartSpan reentrancy coโ€ฆ
buenaflor Jun 29, 2026
642cfb0
Merge branch 'feat/app-start-extension-android' into feat/app-start-eโ€ฆ
buenaflor Jun 29, 2026
8e4fa7c
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 29, 2026
33a6aa0
refactor(extend-app-start): Rename isAppStartWindowOpen to canExtendAโ€ฆ
buenaflor Jun 29, 2026
e12f7b0
Merge branch 'feat/app-start-extension-android' into feat/app-start-eโ€ฆ
buenaflor Jun 29, 2026
4a16c4a
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 29, 2026
210b4ee
test(extend-app-start): Drop redundant getExtendedAppStartSpan finishโ€ฆ
buenaflor Jun 29, 2026
9ebdd09
Merge branch 'feat/app-start-extension-android' into feat/app-start-eโ€ฆ
buenaflor Jun 29, 2026
7aadcb9
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 29, 2026
824c12f
test(extend-app-start): Drop narrating comments from app start tests
buenaflor Jun 29, 2026
cee0b84
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 29, 2026
bdadd2b
feat(extend-app-start): Add setData and isExtended to AppStartExtension
buenaflor Jun 29, 2026
d87e908
Merge branch 'feat/app-start-extension-android' into feat/app-start-eโ€ฆ
buenaflor Jun 29, 2026
45472ea
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 29, 2026
c861ba9
refactor(extend-app-start): Name app start branching booleans by intent
buenaflor Jun 29, 2026
b11b0fa
fix(extend-app-start): Make shouldSendStartMeasurements volatile
buenaflor Jun 29, 2026
d8ffbbc
Merge branch 'feat/app-start-extension-android' into feat/app-start-eโ€ฆ
buenaflor Jun 29, 2026
6f6b8e3
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jun 29, 2026
04c2835
docs(extend-app-start): Explain why AppStartExtension holds span and โ€ฆ
buenaflor Jul 2, 2026
b8779ca
feat(extend-app-start): Return null from getExtendedAppStartSpan whenโ€ฆ
buenaflor Jul 2, 2026
adedde8
Merge branch 'feat/app-start-extension-core' into feat/app-start-exteโ€ฆ
buenaflor Jul 2, 2026
8420f74
feat(extend-app-start): Return null from AppStartExtension.getExtendeโ€ฆ
buenaflor Jul 2, 2026
fd32a34
Merge branch 'feat/app-start-extension-android' into feat/app-start-eโ€ฆ
buenaflor Jul 2, 2026
5590df0
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jul 2, 2026
3d4d55a
test(extend-app-start): Assert null extended span now that getExtendeโ€ฆ
buenaflor Jul 2, 2026
41a8e05
Merge branch 'feat/app-start-extension-materialize' into feat/app-staโ€ฆ
buenaflor Jul 2, 2026
71b7584
feat(extend-app-start): Make Sentry.getExtendedAppStartSpan() nullable
buenaflor Jul 2, 2026
9caa920
Merge remote-tracking branch 'origin/feat/extend-app-start' into featโ€ฆ
buenaflor Jul 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.Application;
import android.os.StrictMode;
import io.sentry.ISpan;
import io.sentry.Sentry;
import io.sentry.samples.android.sqlite.SampleDatabases;

Expand All @@ -19,6 +20,8 @@ public void onCreate() {
strictMode();
super.onCreate();

extendAppStartExample();

SampleDatabases.INSTANCE.warmUp(this);

// Example how to initialize the SDK manually which allows access to SentryOptions callbacks.
Expand All @@ -36,6 +39,35 @@ public void onCreate() {
// });
}

// Example of extending the app start: launch-time work done here (after the SDK auto-inits) is
// included in the app start measurement. Requires standalone app start tracing
// (io.sentry.standalone-app-start-tracing.enable in the manifest). The artificial delays stand in
// for real launch work, e.g. loading remote config or feature flags before the first screen.
private void extendAppStartExample() {
Sentry.extendAppStart();

final ISpan extendedSpan = Sentry.getExtendedAppStartSpan();
if (extendedSpan != null) {
final ISpan configSpan = extendedSpan.startChild("remote_config", "Load remote config");
artificialDelay(200);
configSpan.finish();

final ISpan flagsSpan = extendedSpan.startChild("feature_flags", "Fetch feature flags");
artificialDelay(100);
flagsSpan.finish();
}

Sentry.finishExtendedAppStart();
}

private static void artificialDelay(final long millis) {
try {
Thread.sleep(millis);
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
}
}

private void strictMode() {
// https://developer.android.com/reference/android/os/StrictMode
// StrictMode is a developer tool which detects things you might be doing by accident and
Expand Down
3 changes: 3 additions & 0 deletions sentry/api/sentry.api
Original file line number Diff line number Diff line change
Expand Up @@ -2769,7 +2769,9 @@ public final class io/sentry/Sentry {
public static fun continueTrace (Ljava/lang/String;Ljava/util/List;)Lio/sentry/TransactionContext;
public static fun distribution ()Lio/sentry/IDistributionApi;
public static fun endSession ()V
public static fun extendAppStart ()V
public static fun feedback ()Lio/sentry/IFeedbackApi;
public static fun finishExtendedAppStart ()V
public static fun flush (J)V
public static fun forkedCurrentScope (Ljava/lang/String;)Lio/sentry/IScopes;
public static fun forkedRootScopes (Ljava/lang/String;)Lio/sentry/IScopes;
Expand All @@ -2778,6 +2780,7 @@ public final class io/sentry/Sentry {
public static fun getCurrentHub ()Lio/sentry/IHub;
public static fun getCurrentScopes ()Lio/sentry/IScopes;
public static fun getCurrentScopes (Z)Lio/sentry/IScopes;
public static fun getExtendedAppStartSpan ()Lio/sentry/ISpan;
public static fun getGlobalScope ()Lio/sentry/IScope;
public static fun getLastEventId ()Lio/sentry/protocol/SentryId;
public static fun getSpan ()Lio/sentry/ISpan;
Expand Down
32 changes: 32 additions & 0 deletions sentry/src/main/java/io/sentry/Sentry.java
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,38 @@ public static void reportFullyDisplayed() {
getCurrentScopes().reportFullyDisplayed();
}

/**
* Begins extending the app start so launch-time work done after {@code Application.onCreate}
* (e.g. loading remote config before the first screen) is included in the app start measurement.
*
* <p>Intended to be called from {@code Application.onCreate} right after {@code
* SentryAndroid.init}. Only effective on Android with standalone app start tracing enabled;
* otherwise it is a no-op. Also no-ops if the app start already finished, none is in progress, or
* it was already extended (first call wins). Call {@link #finishExtendedAppStart()} once the
* extra work is done; if it is never called, the app start transaction is finished by its
* deadline and no extended measurement is reported.
*/
public static void extendAppStart() {
getCurrentScopes().getOptions().getAppStartExtender().extendAppStart();
}

/**
* Finishes the app start extension started by {@link #extendAppStart()}, allowing the app start
* transaction to complete. No-ops if the app start was not extended or this was already called.
*/
public static void finishExtendedAppStart() {
getCurrentScopes().getOptions().getAppStartExtender().finishExtendedAppStart();
}

/**
* Returns the active extended app start span, to attach child spans for the launch-time work
* being measured, or {@code null} when no extension is active (e.g. {@link #extendAppStart()} was
* not called, the app start window already passed, or standalone app start tracing is disabled).
*/
public static @Nullable ISpan getExtendedAppStartSpan() {
return getCurrentScopes().getOptions().getAppStartExtender().getExtendedAppStartSpan();
}

/**
* Configuration options callback
*
Expand Down
49 changes: 49 additions & 0 deletions sentry/src/test/java/io/sentry/SentryTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1769,4 +1769,53 @@ class SentryTest {
val scopes = Sentry.getCurrentScopes()
assertFalse(scopes.isNoOp)
}

// region app start extension

private fun initWithExtender(extender: IAppStartExtender) {
initForTest {
it.dsn = dsn
it.setAppStartExtender(extender)
}
}

@Test
fun `extendAppStart delegates to the app start extender`() {
val extender = mock<IAppStartExtender>()
initWithExtender(extender)

Sentry.extendAppStart()

verify(extender).extendAppStart()
}

@Test
fun `finishExtendedAppStart delegates to the app start extender`() {
val extender = mock<IAppStartExtender>()
initWithExtender(extender)

Sentry.finishExtendedAppStart()

verify(extender).finishExtendedAppStart()
}

@Test
fun `getExtendedAppStartSpan delegates to the app start extender`() {
val span = mock<ISpan>()
val extender = mock<IAppStartExtender>()
whenever(extender.extendedAppStartSpan).thenReturn(span)
initWithExtender(extender)

assertSame(span, Sentry.getExtendedAppStartSpan())
}

@Test
fun `app start extension api is a no-op when the SDK is disabled`() {
// beforeTest called Sentry.close(), so the current scopes are NoOp.
Sentry.extendAppStart()
Sentry.finishExtendedAppStart()
assertNull(Sentry.getExtendedAppStartSpan())
}

// endregion
}
Loading