Title: feat: Send standalone app start transactions · Issue #5046 · getsentry/sentry-java · GitHub
Open Graph Title: feat: Send standalone app start transactions · Issue #5046 · getsentry/sentry-java
X Title: feat: Send standalone app start transactions · Issue #5046 · getsentry/sentry-java
Description: Currently, app start data is only captured when a ui.load transaction (Activity tracing) starts within the app start window. If no qualifying transaction occurs, app start data is lost entirely. Proposal Instead of attaching app start sp...
Open Graph Description: Currently, app start data is only captured when a ui.load transaction (Activity tracing) starts within the app start window. If no qualifying transaction occurs, app start data is lost entirely. Pr...
X Description: Currently, app start data is only captured when a ui.load transaction (Activity tracing) starts within the app start window. If no qualifying transaction occurs, app start data is lost entirely. Pr...
Opengraph URL: https://github.com/getsentry/sentry-java/issues/5046
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat: Send standalone app start transactions","articleBody":"Currently, app start data is only captured when a `ui.load` transaction (Activity tracing) starts within the app start window. If no qualifying transaction occurs, app start data is lost entirely.\n\n### Proposal\n\nInstead of attaching app start spans and measurements to the first Activity transaction, the SDK should send a standalone app start transaction as soon as app start data is available. This transaction carries all the same spans, measurements (`app_start_cold`/`app_start_warm`, TTID, TTFD), and context (`app.start_type`) that are currently attached to the first `ui.load` transaction.\n\n> **Note:** This proposal was generated with Claude Code based on analysis of the Cocoa SDK implementation. Please double-check the details before implementing.\n\n### Transaction / Span Tree\n\n```\nTransaction: \"App Start\" (op: app.start)\n├── process.load\n├── contentprovider.load\n├── application.load\n└── activity lifecycle spans\n```\n\n### Details\n\n- **Transaction name:** `App Start`. The mobile vitals insights dashboard groups transactions by name, so including the app start type allows users to inspect cold and warm starts separately.\n- **Transaction operation:** `app.start`.\n- **Rollout:** Opt-in via a new option `enableStandaloneAppStartTracing`, disabled by default.\n- **Backwards compatibility:** When the option is disabled, existing behavior is unchanged — app start data continues to be attached to the first Activity `ui.load` transaction. When enabled, the first Activity transaction still works correctly on its own, just without the app start spans/measurements attached.\n- **No duplicate data:** When this feature is enabled, the SDK must **not** attach app start spans and measurements to the first Activity transaction. App start data is only sent via the standalone transaction to avoid duplication.\n- **Hybrid SDKs:** Flutter and React Native pull raw app start data from the native layer via `InternalSentrySdk.getAppStartMeasurement()` and construct their own transactions. `enableStandaloneAppStartTracing` should **not** activate when a hybrid SDK is consuming native app start data, to avoid duplicate transactions. See the [hybrid SDK analysis on the Cocoa issue](https://github.com/getsentry/sentry-cocoa/issues/6883#issuecomment-4030699984) for details.\n\n\u003cdetails>\n\u003csummary>Detailed breakdown of what needs to change\u003c/summary>\n\n### Current transaction structure (attached to first Activity)\n\n```\nTransaction: \"MainActivity\" (op: ui.load)\n ├── Cold Start (op: app.start.cold) ← grouping span\n │ ├── process.load\n │ ├── contentprovider.load\n │ ├── application.load\n │ └── activity lifecycle spans\n ├── MainActivity initial display (op: ui.load.initial_display)\n └── MainActivity full display (op: ui.load.full_display)\n```\n\n### Target transaction structure (standalone)\n\n```\nTransaction: \"App Start\" (op: app.start) ← root\n ├── process.load\n ├── contentprovider.load\n ├── application.load\n └── activity lifecycle spans\n```\n\n### Changes required\n\n**1. New option**\nAdd `enableStandaloneAppStartTracing` to `SentryAndroidOptions` (experimental, disabled by default).\n\n**2. Standalone transaction creation**\nNew class (e.g., `StandaloneAppStartStrategy`) that:\n- Creates a transaction with `op: app.start.cold` / `app.start.warm`, name `\"App Start Cold\"` / `\"App Start Warm\"`\n- Passes `AppStartMetrics` data directly via `TransactionOptions` instead of relying on the global singleton\n- Finishes immediately (timing data is already fully collected)\n- Phase spans are direct children of the root (no intermediate grouping span)\n\n**3. `ActivityLifecycleIntegration` changes**\nWhen standalone mode is enabled:\n- Skip creating the `appStartSpan` child on the first Activity transaction (lines 256-268)\n- The `ui.load` transaction still gets created normally, just without app start data attached\n- Trigger the standalone transaction from `onFirstFrameDrawn()` when app start timing is finalized\n\n**4. `PerformanceAndroidEventProcessor` changes**\nWhen standalone mode is enabled:\n- The `hasAppStartSpan()` check naturally returns false (no app start span on the `ui.load` transaction), so measurements and child spans are not attached\n- For the standalone transaction, the processor needs to attach the child spans (process init, content providers, application.load) as direct children of the root instead of under a grouping span\n\n**5. Hybrid SDK guard**\n`InternalSentrySdk.getAppStartMeasurement()` is used by Flutter/RN to pull raw app start data. The standalone option should not activate when a hybrid SDK is consuming native app start data, to avoid duplicate transactions.\n\n### Key code locations\n\n| File | Role |\n|------|------|\n| `AppStartMetrics.java` | Singleton collecting all timing data via instrumentation hooks |\n| `ActivityLifecycleIntegration.java:160-313` | Creates `ui.load` transaction + `app.start.cold/warm` child span |\n| `PerformanceAndroidEventProcessor.java:76-141` | Adds measurements + child spans to transaction before sending |\n| `PerformanceAndroidEventProcessor.java:224-277` | `attachAppStartSpans()` — adds process init, content provider, app.load spans |\n| `InternalSentrySdk.java:216-240` | `getAppStartMeasurement()` — hybrid SDK bridge |\n| `SentryPerformanceProvider.java` | ContentProvider that captures process start time |\n\n\u003c/details>\n\n### Reference: Cocoa SDK implementation\n\nA proof of concept has already been implemented in the Cocoa SDK: [PR #7660](https://github.com/getsentry/sentry-cocoa/pull/7660) ([tracking issue](https://github.com/getsentry/sentry-cocoa/issues/6883)). The Java SDK's architecture (`AppStartMetrics` singleton + `ActivityLifecycleIntegration` attachment) maps directly onto the Cocoa approach (`SentryAppStartMeasurementProvider` + `SentryTracer` attachment), so the same pattern applies.\n\n### Follow-up work\n\n- **App start sample rate:** With standalone app start transactions, we know at transaction creation time that it's an app start, which makes it possible to set a different (e.g., 100%) sample rate for app start transactions specifically. This should be a follow-up issue.\n- **Same trace ID:** The standalone app start transaction and the first screen load (`ui.load`) transaction should share the same `traceId` so they appear linked in the trace view. The app start transaction should be created with a trace ID that the subsequent first `ui.load` transaction inherits.\n- **Mobile Vitals dashboard:** The sentry product's Mobile Vitals page hard-filters on `transaction.op:[ui.load,navigation]`, which excludes `app.start.*` ops. Dashboard changes are needed — see the [detailed analysis on the Cocoa issue](https://github.com/getsentry/sentry-cocoa/issues/6883#issuecomment-4022581135).\n- **Cross-platform alignment:** Once validated, Flutter and React Native should also adopt standalone app start transactions with `op: app.start.cold/warm` (React Native already has a standalone mode but uses `op: ui.load` — see [hybrid SDK analysis](https://github.com/getsentry/sentry-cocoa/issues/6883#issuecomment-4030699984)).\n\nThe specification was updated by @philipphofmann based on the Cocoa SDK implementation. If you have any clarifying questions, please ping him.","author":{"url":"https://github.com/noahsmartin","@type":"Person","name":"noahsmartin"},"datePublished":"2026-01-21T04:10:25Z","url":"https://github.com/getsentry/sentry-java/issues/5046"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:255c7dcb-ce77-bfeb-ae31-04a2334c8b1d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 809A:3CEE1E:491989:6788D7:6B047268 |
| html-safe-nonce | a82e70367aa4bea067eedc22b85d95b9d27099021436167787153d89c3b7b401 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDlBOjNDRUUxRTo0OTE5ODk6Njc4OEQ3OjZCMDQ3MjY4IiwidmlzaXRvcl9pZCI6Ijg4MzA1MzU5NDMwMDMwNzUxNzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f8efe9a3dc3b2bdee3b8f6bdd231840051f080ae1ee70eacff8c9d781940e687 |
| hovercard-subject-tag | issue:3836489195 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-java/5046/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8160816de6664444fe0e2de43f51e68ead4848a560897d5fd805ee5dad542d57/getsentry/sentry-java/issues/5046 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8160816de6664444fe0e2de43f51e68ead4848a560897d5fd805ee5dad542d57/getsentry/sentry-java/issues/5046 |
| og:image:alt | Currently, app start data is only captured when a ui.load transaction (Activity tracing) starts within the app start window. If no qualifying transaction occurs, app start data is lost entirely. Pr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | noahsmartin |
| hostname | github.com |
| expected-hostname | github.com |
| None | ae8802492f12d3ba4f6b0d814054e617a2a5616b6327bf8555c10cd5b0dc2a6f |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-java git https://github.com/getsentry/sentry-java.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3368190 |
| octolytics-dimension-repository_nwo | getsentry/sentry-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3368190 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cfb5f24c6e01d85f70804652a5107e5cac03a161 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width