Skip to content

Commit 914316c

Browse files
committed
feat(astro): Update @sentry/astro to use OpenTelemetry
1 parent 7b7370f commit 914316c

File tree

10 files changed

+48
-23
lines changed

10 files changed

+48
-23
lines changed

packages/astro/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"dependencies": {
5252
"@sentry/browser": "8.0.0-alpha.2",
5353
"@sentry/core": "8.0.0-alpha.2",
54-
"@sentry/node-experimental": "8.0.0-alpha.2",
54+
"@sentry/node": "8.0.0-alpha.2",
5555
"@sentry/types": "8.0.0-alpha.2",
5656
"@sentry/utils": "8.0.0-alpha.2",
5757
"@sentry/vite-plugin": "^2.14.2"

packages/astro/src/index.server.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Node SDK exports
2-
// Unfortunately, we cannot `export * from '@sentry/node-experimental'` because in prod builds,
2+
// Unfortunately, we cannot `export * from '@sentry/node'` because in prod builds,
33
// Vite puts these exports into a `default` property (Sentry.default) rather than
44
// on the top - level namespace.
55

@@ -37,7 +37,6 @@ export {
3737
setHttpStatus,
3838
withScope,
3939
withIsolationScope,
40-
autoDiscoverNodePerformanceMonitoringIntegrations,
4140
makeNodeTransport,
4241
getDefaultIntegrations,
4342
defaultStackParser,
@@ -47,7 +46,6 @@ export {
4746
addRequestDataToEvent,
4847
DEFAULT_USER_INCLUDES,
4948
extractRequestData,
50-
Integrations,
5149
consoleIntegration,
5250
onUncaughtExceptionIntegration,
5351
onUnhandledRejectionIntegration,
@@ -59,7 +57,6 @@ export {
5957
functionToStringIntegration,
6058
inboundFiltersIntegration,
6159
linkedErrorsIntegration,
62-
Handlers,
6360
setMeasurement,
6461
getActiveSpan,
6562
startSpan,
@@ -74,10 +71,24 @@ export {
7471
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
7572
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
7673
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
77-
} from '@sentry/node-experimental';
74+
expressIntegration,
75+
expressErrorHandler,
76+
setupExpressErrorHandler,
77+
fastifyIntegration,
78+
graphqlIntegration,
79+
mongoIntegration,
80+
mongooseIntegration,
81+
mysqlIntegration,
82+
mysql2Integration,
83+
nestIntegration,
84+
postgresIntegration,
85+
prismaIntegration,
86+
hapiIntegration,
87+
setupHapiErrorHandler,
88+
} from '@sentry/node';
7889

7990
// We can still leave this for the carrier init and type exports
80-
export * from '@sentry/node-experimental';
91+
export * from '@sentry/node';
8192

8293
export { init } from './server/sdk';
8394

packages/astro/src/index.types.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ import sentryAstro from './index.server';
1313
/** Initializes Sentry Astro SDK */
1414
export declare function init(options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions): void;
1515

16-
// We only export server Integrations for now, until the exports are removed from Svelte and Node SDKs.
17-
// Necessary to avoid type collision.
18-
export declare const Integrations: typeof serverSdk.Integrations;
19-
2016
export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
2117
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;
2218

@@ -26,5 +22,17 @@ export declare const defaultStackParser: StackParser;
2622
export declare function close(timeout?: number | undefined): PromiseLike<boolean>;
2723
export declare function flush(timeout?: number | undefined): PromiseLike<boolean>;
2824

25+
// eslint-disable-next-line deprecation/deprecation
26+
export declare const makeMain: typeof clientSdk.makeMain;
27+
export declare const getActiveSpan: typeof clientSdk.getActiveSpan;
28+
// eslint-disable-next-line deprecation/deprecation
29+
export declare const getCurrentHub: typeof clientSdk.getCurrentHub;
30+
export declare const getClient: typeof clientSdk.getClient;
31+
export declare const startSpan: typeof clientSdk.startSpan;
32+
export declare const startInactiveSpan: typeof clientSdk.startInactiveSpan;
33+
export declare const startSpanManual: typeof clientSdk.startSpanManual;
34+
export declare const withActiveSpan: typeof clientSdk.withActiveSpan;
35+
export declare const Span: clientSdk.Span;
36+
2937
export declare const metrics: typeof clientSdk.metrics & typeof serverSdk.metrics;
3038
export default sentryAstro;

packages/astro/src/integration/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
9191
// @sentry/node is required in case we have 2 different @sentry/node
9292
// packages installed in the same project.
9393
// Ref: https://github.com/getsentry/sentry-javascript/issues/10121
94-
noExternal: ['@sentry/astro', '@sentry/node-experimental', '@sentry/node'],
94+
noExternal: ['@sentry/astro', '@sentry/node'],
9595
},
9696
},
9797
});

packages/astro/src/server/middleware.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, setHttpStatus } from '@sentry/core';
21
import {
2+
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
3+
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
34
captureException,
45
continueTrace,
56
getActiveSpan,
67
getClient,
78
getCurrentScope,
9+
setHttpStatus,
810
startSpan,
911
withIsolationScope,
10-
} from '@sentry/node-experimental';
12+
} from '@sentry/node';
1113
import type { Client, Scope, Span, SpanAttributes } from '@sentry/types';
1214
import { addNonEnumerableProperty, objectify, stripUrlQueryAndFragment } from '@sentry/utils';
1315
import type { APIContext, MiddlewareResponseHandler } from 'astro';

packages/astro/src/server/sdk.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { applySdkMetadata } from '@sentry/core';
2-
import type { NodeOptions } from '@sentry/node-experimental';
3-
import { init as initNodeSdk, setTag } from '@sentry/node-experimental';
2+
import type { NodeOptions } from '@sentry/node';
3+
import { init as initNodeSdk, setTag } from '@sentry/node';
44

55
/**
66
*

packages/astro/test/client/sdk.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import type { BrowserClient } from '@sentry/browser';
2-
import { getActiveSpan } from '@sentry/browser';
3-
import { browserTracingIntegration } from '@sentry/browser';
2+
import {
3+
browserTracingIntegration,
4+
getActiveSpan,
5+
getCurrentScope,
6+
getGlobalScope,
7+
getIsolationScope,
8+
} from '@sentry/browser';
49
import * as SentryBrowser from '@sentry/browser';
510
import { SDK_VERSION, getClient } from '@sentry/browser';
611
import { vi } from 'vitest';
712

8-
import { getCurrentScope, getGlobalScope, getIsolationScope } from '@sentry/core';
913
import { init } from '../../../astro/src/client/sdk';
1014

1115
const browserInit = vi.spyOn(SentryBrowser, 'init');

packages/astro/test/server/meta.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { vi } from 'vitest';
55

66
import { getTracingMetaTags, isValidBaggageString } from '../../src/server/meta';
77

8-
const TRACE_FLAG_SAMPLED = 0x1;
8+
const TRACE_FLAG_SAMPLED = 1;
99

1010
const mockedSpan = new SentrySpan({
1111
traceId: '12345678901234567890123456789012',

packages/astro/test/server/middleware.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
2-
import * as SentryNode from '@sentry/node-experimental';
2+
import * as SentryNode from '@sentry/node';
33
import type { Client, Span } from '@sentry/types';
44
import { vi } from 'vitest';
55

packages/astro/test/server/sdk.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as SentryNode from '@sentry/node-experimental';
2-
import { SDK_VERSION } from '@sentry/node-experimental';
1+
import * as SentryNode from '@sentry/node';
2+
import { SDK_VERSION } from '@sentry/node';
33
import { vi } from 'vitest';
44

55
import { init } from '../../src/server/sdk';

0 commit comments

Comments
 (0)