Skip to content

Commit da20ca9

Browse files
authored
feat(tracing): Track standalone app start adoption (#6427)
* feat(core): Track GlobalErrorBoundary adoption Register a no-op `GlobalErrorBoundary` integration when the component mounts so the name flows through to `event.sdk.integrations` — the same channel used for feature- adoption signals like `MobileFeedback` and `AppStart`. Also introduces a shared `registerFeatureMarker` helper. Subsequent markers for other opt-in features (NavigationContainer, ExpoRouter error boundary, AppLoaded, ...) will use this helper — see #6415. Refs: #6415 * feat(tracing): Track standalone app start adoption When `_experiments.enableStandaloneAppStartTracing` is enabled, also add a no-op `StandaloneAppStart` integration to the default integrations list so the name flows through to `event.sdk.integrations`. Refs: #6415 * fix(tracing): Fire StandaloneAppStart marker regardless of tracing config The marker is meant as an adoption signal for the `enableStandaloneAppStartTracing` experiment flag itself, so it must reach errors-only projects and configs where tracing / `enableAppStartTracking` / `enableNative` are off. Reported by Cursor Bugbot on PR #6427.
1 parent 993bd3b commit da20ca9

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

packages/core/src/js/integrations/default.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ import {
4646
viewHierarchyIntegration,
4747
} from './exports';
4848

49+
const STANDALONE_APP_START_INTEGRATION_NAME = 'StandaloneAppStart';
50+
4951
/**
5052
* Returns the default ReactNative integrations based on the current environment.
5153
*
@@ -115,6 +117,12 @@ export function getDefaultIntegrations(options: ReactNativeClientOptions): Integ
115117
if (hasTracingEnabled && options.enableAppStartTracking && options.enableNative) {
116118
integrations.push(appStartIntegration({ standalone: !!options._experiments?.enableStandaloneAppStartTracing }));
117119
}
120+
// Registered outside the tracing/appStart/native gate: this is an adoption
121+
// marker for the experiment flag itself, so it must reach errors-only
122+
// projects and any config where tracing is disabled.
123+
if (options._experiments?.enableStandaloneAppStartTracing) {
124+
integrations.push({ name: STANDALONE_APP_START_INTEGRATION_NAME });
125+
}
118126
const nativeFramesIntegrationInstance = createNativeFramesIntegrations(
119127
hasTracingEnabled && options.enableNativeFramesTracking && options.enableNative,
120128
);

packages/core/test/integrations/defaultAppStart.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,30 @@ describe('getDefaultIntegrations - standalone app start wiring', () => {
4242

4343
expect(appStartIntegration).toHaveBeenCalledWith({ standalone: false });
4444
});
45+
46+
it('includes the StandaloneAppStart marker when the experiment flag is enabled', () => {
47+
const integrations = getDefaultIntegrations(
48+
createOptions({ _experiments: { enableStandaloneAppStartTracing: true } }),
49+
);
50+
51+
expect(integrations.some(i => i.name === 'StandaloneAppStart')).toBe(true);
52+
});
53+
54+
it('does not include the StandaloneAppStart marker when the experiment flag is off', () => {
55+
const integrations = getDefaultIntegrations(createOptions({}));
56+
57+
expect(integrations.some(i => i.name === 'StandaloneAppStart')).toBe(false);
58+
});
59+
60+
it.each([
61+
['tracing disabled', { tracesSampleRate: undefined }],
62+
['app start tracking off', { enableAppStartTracking: false }],
63+
['native off', { enableNative: false }],
64+
])('includes the StandaloneAppStart marker when the flag is on and %s', (_label, overrides) => {
65+
const integrations = getDefaultIntegrations(
66+
createOptions({ ...overrides, _experiments: { enableStandaloneAppStartTracing: true } }),
67+
);
68+
69+
expect(integrations.some(i => i.name === 'StandaloneAppStart')).toBe(true);
70+
});
4571
});

0 commit comments

Comments
 (0)