Skip to content

Commit 2b7f708

Browse files
committed
add all integrations
1 parent f2e0be1 commit 2b7f708

File tree

19 files changed

+156
-1
lines changed

19 files changed

+156
-1
lines changed

dev-packages/e2e-tests/test-applications/nextjs-app-dir/app/server-component/featureFlag/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ export const dynamic = 'force-dynamic';
44

55
export default async function FeatureFlagServerComponent() {
66
Sentry.buildLaunchDarklyFlagUsedHandler();
7+
Sentry.launchDarklyIntegration();
8+
Sentry.openFeatureIntegration();
9+
Sentry.statsigIntegration();
10+
Sentry.unleashIntegration();
11+
Sentry.OpenFeatureIntegrationHook();
712

813
return <div>FeatureFlagServerComponent</div>;
914
}

dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/server-components.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,6 @@ test('Should capture an error and transaction for a app router page', async ({ p
136136

137137
test('Should not throw error on server component when importing shimmed feature flag function', async ({ page }) => {
138138
await page.goto('/server-component/featureFlag');
139+
// tests that none of the feature flag functions throw an error when imported in a node environment
139140
await expect(page.locator('body')).toContainText('FeatureFlagServerComponent');
140141
});

packages/astro/src/index.server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ export {
140140
type FeatureFlagsIntegration,
141141
launchDarklyIntegration,
142142
buildLaunchDarklyFlagUsedHandler,
143+
openFeatureIntegration,
144+
OpenFeatureIntegrationHook,
145+
statsigIntegration,
146+
unleashIntegration,
143147
} from '@sentry/node';
144148

145149
export { init } from './server/sdk';

packages/astro/src/index.types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,9 @@ export declare const logger: typeof clientSdk.logger | typeof serverSdk.logger;
3131

3232
export declare const launchDarklyIntegration: typeof clientSdk.launchDarklyIntegration;
3333
export declare const buildLaunchDarklyFlagUsedHandler: typeof clientSdk.buildLaunchDarklyFlagUsedHandler;
34+
export declare const openFeatureIntegration: typeof clientSdk.openFeatureIntegration;
35+
export declare const OpenFeatureIntegrationHook: typeof clientSdk.OpenFeatureIntegrationHook;
36+
export declare const statsigIntegration: typeof clientSdk.statsigIntegration;
37+
export declare const unleashIntegration: typeof clientSdk.unleashIntegration;
3438

3539
export default sentryAstro;

packages/aws-serverless/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ export {
126126
type FeatureFlagsIntegration,
127127
launchDarklyIntegration,
128128
buildLaunchDarklyFlagUsedHandler,
129+
openFeatureIntegration,
130+
OpenFeatureIntegrationHook,
131+
statsigIntegration,
132+
unleashIntegration,
129133
} from '@sentry/node';
130134

131135
export {

packages/bun/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ export {
144144
featureFlagsIntegration,
145145
launchDarklyIntegration,
146146
buildLaunchDarklyFlagUsedHandler,
147+
openFeatureIntegration,
148+
OpenFeatureIntegrationHook,
149+
statsigIntegration,
150+
unleashIntegration,
147151
} from '@sentry/node';
148152

149153
export {

packages/google-cloud-serverless/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ export {
126126
type FeatureFlagsIntegration,
127127
launchDarklyIntegration,
128128
buildLaunchDarklyFlagUsedHandler,
129+
openFeatureIntegration,
130+
OpenFeatureIntegrationHook,
131+
statsigIntegration,
132+
unleashIntegration,
129133
} from '@sentry/node';
130134

131135
export {

packages/nextjs/src/index.types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,7 @@ export { captureRequestError } from './common/captureRequestError';
144144

145145
export declare const launchDarklyIntegration: typeof clientSdk.launchDarklyIntegration;
146146
export declare const buildLaunchDarklyFlagUsedHandler: typeof clientSdk.buildLaunchDarklyFlagUsedHandler;
147+
export declare const openFeatureIntegration: typeof clientSdk.openFeatureIntegration;
148+
export declare const OpenFeatureIntegrationHook: typeof clientSdk.OpenFeatureIntegrationHook;
149+
export declare const statsigIntegration: typeof clientSdk.statsigIntegration;
150+
export declare const unleashIntegration: typeof clientSdk.unleashIntegration;

packages/node/src/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,14 @@ export { amqplibIntegration } from './integrations/tracing/amqplib';
3737
export { vercelAIIntegration } from './integrations/tracing/vercelai';
3838
export { childProcessIntegration } from './integrations/childProcess';
3939
export { createSentryWinstonTransport } from './integrations/winston';
40-
export { launchDarklyIntegration, buildLaunchDarklyFlagUsedHandler } from './integrations/featureFlagShims';
40+
export {
41+
launchDarklyIntegration,
42+
buildLaunchDarklyFlagUsedHandler,
43+
openFeatureIntegration,
44+
OpenFeatureIntegrationHook,
45+
statsigIntegration,
46+
unleashIntegration,
47+
} from './integrations/featureFlagShims';
4148

4249
export { SentryContextManager } from './otel/contextManager';
4350
export { generateInstrumentOnce } from './otel/instrument';

packages/node/src/integrations/featureFlagShims/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,12 @@ export {
22
launchDarklyIntegrationShim as launchDarklyIntegration,
33
buildLaunchDarklyFlagUsedHandlerShim as buildLaunchDarklyFlagUsedHandler,
44
} from './launchDarkly';
5+
6+
export {
7+
openFeatureIntegrationShim as openFeatureIntegration,
8+
OpenFeatureIntegrationHookShim as OpenFeatureIntegrationHook,
9+
} from './openFeature';
10+
11+
export { statsigIntegrationShim as statsigIntegration } from './statsig';
12+
13+
export { unleashIntegrationShim as unleashIntegration } from './unleash';
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { consoleSandbox, defineIntegration, isBrowser } from '@sentry/core';
2+
3+
/**
4+
* This is a shim for the OpenFeature integration.
5+
* We need this in order to not throw runtime errors when accidentally importing this on the server through a meta framework like Next.js.
6+
*/
7+
export const openFeatureIntegrationShim = defineIntegration((_options?: unknown) => {
8+
if (!isBrowser()) {
9+
consoleSandbox(() => {
10+
// eslint-disable-next-line no-console
11+
console.warn('The openFeatureIntegration() can only be used in the browser.');
12+
});
13+
}
14+
15+
return {
16+
name: 'OpenFeature',
17+
};
18+
});
19+
20+
/**
21+
* This is a shim for the OpenFeature integration hook.
22+
*/
23+
export class OpenFeatureIntegrationHookShim {
24+
/**
25+
*
26+
*/
27+
public constructor() {
28+
if (!isBrowser()) {
29+
consoleSandbox(() => {
30+
// eslint-disable-next-line no-console
31+
console.warn('The OpenFeatureIntegrationHook can only be used in the browser.');
32+
});
33+
}
34+
}
35+
36+
/**
37+
*
38+
*/
39+
public after(): void {
40+
// No-op
41+
}
42+
43+
/**
44+
*
45+
*/
46+
public error(): void {
47+
// No-op
48+
}
49+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { consoleSandbox, defineIntegration, isBrowser } from '@sentry/core';
2+
3+
/**
4+
* This is a shim for the Statsig integration.
5+
* We need this in order to not throw runtime errors when accidentally importing this on the server through a meta framework like Next.js.
6+
*/
7+
export const statsigIntegrationShim = defineIntegration((_options?: unknown) => {
8+
if (!isBrowser()) {
9+
consoleSandbox(() => {
10+
// eslint-disable-next-line no-console
11+
console.warn('The statsigIntegration() can only be used in the browser.');
12+
});
13+
}
14+
15+
return {
16+
name: 'Statsig',
17+
};
18+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { consoleSandbox, defineIntegration, isBrowser } from '@sentry/core';
2+
3+
/**
4+
* This is a shim for the Unleash integration.
5+
* We need this in order to not throw runtime errors when accidentally importing this on the server through a meta framework like Next.js.
6+
*/
7+
export const unleashIntegrationShim = defineIntegration((_options?: unknown) => {
8+
if (!isBrowser()) {
9+
consoleSandbox(() => {
10+
// eslint-disable-next-line no-console
11+
console.warn('The unleashIntegration() can only be used in the browser.');
12+
});
13+
}
14+
15+
return {
16+
name: 'Unleash',
17+
};
18+
});

packages/nuxt/src/index.types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ export declare const logger: typeof clientSdk.logger | typeof serverSdk.logger;
2121

2222
export declare const launchDarklyIntegration: typeof clientSdk.launchDarklyIntegration;
2323
export declare const buildLaunchDarklyFlagUsedHandler: typeof clientSdk.buildLaunchDarklyFlagUsedHandler;
24+
export declare const openFeatureIntegration: typeof clientSdk.openFeatureIntegration;
25+
export declare const OpenFeatureIntegrationHook: typeof clientSdk.OpenFeatureIntegrationHook;
26+
export declare const statsigIntegration: typeof clientSdk.statsigIntegration;
27+
export declare const unleashIntegration: typeof clientSdk.unleashIntegration;

packages/react-router/src/index.types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ export declare const logger: typeof clientSdk.logger | typeof serverSdk.logger;
2121

2222
export declare const launchDarklyIntegration: typeof clientSdk.launchDarklyIntegration;
2323
export declare const buildLaunchDarklyFlagUsedHandler: typeof clientSdk.buildLaunchDarklyFlagUsedHandler;
24+
export declare const openFeatureIntegration: typeof clientSdk.openFeatureIntegration;
25+
export declare const OpenFeatureIntegrationHook: typeof clientSdk.OpenFeatureIntegrationHook;
26+
export declare const statsigIntegration: typeof clientSdk.statsigIntegration;
27+
export declare const unleashIntegration: typeof clientSdk.unleashIntegration;

packages/remix/src/index.types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ export const lastEventId = runtime === 'client' ? clientSdk.lastEventId : server
3535

3636
export declare const launchDarklyIntegration: typeof clientSdk.launchDarklyIntegration;
3737
export declare const buildLaunchDarklyFlagUsedHandler: typeof clientSdk.buildLaunchDarklyFlagUsedHandler;
38+
export declare const openFeatureIntegration: typeof clientSdk.openFeatureIntegration;
39+
export declare const OpenFeatureIntegrationHook: typeof clientSdk.OpenFeatureIntegrationHook;
40+
export declare const statsigIntegration: typeof clientSdk.statsigIntegration;
41+
export declare const unleashIntegration: typeof clientSdk.unleashIntegration;

packages/solidstart/src/index.types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ export declare const logger: typeof clientSdk.logger | typeof serverSdk.logger;
2828

2929
export declare const launchDarklyIntegration: typeof clientSdk.launchDarklyIntegration;
3030
export declare const buildLaunchDarklyFlagUsedHandler: typeof clientSdk.buildLaunchDarklyFlagUsedHandler;
31+
export declare const openFeatureIntegration: typeof clientSdk.openFeatureIntegration;
32+
export declare const OpenFeatureIntegrationHook: typeof clientSdk.OpenFeatureIntegrationHook;
33+
export declare const statsigIntegration: typeof clientSdk.statsigIntegration;
34+
export declare const unleashIntegration: typeof clientSdk.unleashIntegration;

packages/sveltekit/src/index.types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,7 @@ export declare const logger: typeof clientSdk.logger | typeof serverSdk.logger;
6262

6363
export declare const launchDarklyIntegration: typeof clientSdk.launchDarklyIntegration;
6464
export declare const buildLaunchDarklyFlagUsedHandler: typeof clientSdk.buildLaunchDarklyFlagUsedHandler;
65+
export declare const openFeatureIntegration: typeof clientSdk.openFeatureIntegration;
66+
export declare const OpenFeatureIntegrationHook: typeof clientSdk.OpenFeatureIntegrationHook;
67+
export declare const statsigIntegration: typeof clientSdk.statsigIntegration;
68+
export declare const unleashIntegration: typeof clientSdk.unleashIntegration;

packages/tanstackstart-react/src/index.types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ export declare const logger: typeof clientSdk.logger | typeof serverSdk.logger;
3131

3232
export declare const launchDarklyIntegration: typeof clientSdk.launchDarklyIntegration;
3333
export declare const buildLaunchDarklyFlagUsedHandler: typeof clientSdk.buildLaunchDarklyFlagUsedHandler;
34+
export declare const openFeatureIntegration: typeof clientSdk.openFeatureIntegration;
35+
export declare const OpenFeatureIntegrationHook: typeof clientSdk.OpenFeatureIntegrationHook;
36+
export declare const statsigIntegration: typeof clientSdk.statsigIntegration;
37+
export declare const unleashIntegration: typeof clientSdk.unleashIntegration;

0 commit comments

Comments
 (0)