feat(extend-app-start): [1/4] Add IAppStartExtender bridge#5605
feat(extend-app-start): [1/4] Add IAppStartExtender bridge#5605buenaflor wants to merge 4 commits into
Conversation
|
📲 Install BuildsAndroid
|
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 3d04aae | 324.42 ms | 359.30 ms | 34.88 ms |
| 69d43cc | 380.70 ms | 424.90 ms | 44.20 ms |
| 2821a4d | 315.46 ms | 366.56 ms | 51.10 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 3d04aae | 0 B | 0 B | 0 B |
| 69d43cc | 0 B | 0 B | 0 B |
| 2821a4d | 0 B | 0 B | 0 B |
…s wiring Introduces the @ApiStatus.Internal IAppStartExtender contract (extendAppStart / finishAppStart / getExtendedAppStartSpan) and a NoOp default, wired into SentryOptions. This is the naming-stable core bridge for the app start extension API; it is inert (returns NoOpSpan / no-ops) until the Android implementation and public Sentry facade land later in the stack. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
064d3f1 to
7a7d63f
Compare
| class NoOpAppStartExtenderTest { | ||
| private val extender = NoOpAppStartExtender.getInstance() | ||
|
|
||
| @Test fun `extendAppStart does not throw`() = extender.extendAppStart() | ||
|
|
||
| @Test fun `finishAppStart does not throw`() = extender.finishAppStart() | ||
|
|
||
| @Test | ||
| fun `getExtendedAppStartSpan returns NoOpSpan`() { | ||
| assertSame(NoOpSpan.getInstance(), extender.extendedAppStartSpan) | ||
| } | ||
| } |
There was a problem hiding this comment.
following conventions of existing no-op class tests, lmk if we dont need this
There was a problem hiding this comment.
I would remove this. I don't see a benefit and the downside is that it increases test duration.
There was a problem hiding this comment.
Pull request overview
Adds the core (internal) bridge for the upcoming “extend app start” feature by introducing an IAppStartExtender contract with a default no-op implementation and wiring it into SentryOptions. This establishes stable naming in the core SDK while keeping the feature inert until Android/public facade PRs land later in the stack.
Changes:
- Add
IAppStartExtender(@ApiStatus.Internal) andNoOpAppStartExtenderdefault implementation. - Wire
appStartExtenderintoSentryOptionswith an internal getter/setter and default to the no-op. - Add unit tests for the new option default/setter behavior and for the no-op extender behavior; update
sentry.api.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sentry/src/main/java/io/sentry/SentryOptions.java | Adds appStartExtender field + @ApiStatus.Internal getter/setter with default no-op implementation. |
| sentry/src/main/java/io/sentry/IAppStartExtender.java | Introduces the internal contract bridging future Sentry.extendAppStart()-style APIs to platform implementation. |
| sentry/src/main/java/io/sentry/NoOpAppStartExtender.java | Adds default no-op implementation returning NoOpSpan and no-op lifecycle methods. |
| sentry/src/test/java/io/sentry/SentryOptionsTest.kt | Verifies SentryOptions defaults to NoOpAppStartExtender and returns a custom extender when set. |
| sentry/src/test/java/io/sentry/NoOpAppStartExtenderTest.kt | Tests singleton/no-throw behavior and that the extended span is NoOpSpan. |
| sentry/api/sentry.api | Updates API dump to include the new types and SentryOptions accessor methods. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ix test name typo Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…pStart Mirrors sentry-cocoa's finishExtendedAppLaunch() and makes the API name explicit about finishing the *extended* app start. Renames IAppStartExtender.finishAppStart() and the NoOpAppStartExtender implementation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… inactive Mirrors Sentry.getSpan(): the extender reports null when there is no active extended span instead of a NoOpSpan, so callers can tell there is no span running. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| * that don't provide an app start measurement. | ||
| */ | ||
| @ApiStatus.Internal | ||
| public interface IAppStartExtender { |
There was a problem hiding this comment.
Not related to your PR, but I wish we had an internal package where we can put things that we don't want customers to use. I know there is the @ApiStatus.Internal annotation already but I think have the package would also help organize the code better.
PR Stack (Extend App Start)
📜 Description
Adds the naming-stable core contract for the app start extension API:
IAppStartExtender(@ApiStatus.Internal) + aNoOpAppStartExtenderdefault.SentryOptionsvia a getter/setter, mirroringfullyDisplayedReporter.Inert until later PRs — returns
NoOpSpan/ no-ops until the Android implementation ([2/4]) and the publicSentryfacade ([4/4]) land. Splitting the contract from the machinery keeps the API naming isolated and easy to review.💡 Motivation and Context
First PR of the stack implementing the app start extension API (part of #5553), which lets apps extend the app start measurement to cover extra launch-time work (mirrors sentry-cocoa's
extendAppLaunch()). Splitting into stacked PRs keeps each change small and reviewable.💚 How did you test it?
Unit tests (TDD):
SentryOptionsTest— defaultappStartExtenderisNoOpAppStartExtender; setter works.NoOpAppStartExtenderTest— singleton;getExtendedAppStartSpan()returnsNoOpSpan;extendAppStart()/finishAppStart()no-op../gradlew :sentry:apiCheck :sentry:spotlessJavaCheck :sentry:spotlessKotlinCheckpass.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
[2/4]— extract theAppStartExtensioncomponent insentry-android-core.#skip-changelog