Skip to content

Commit 3269a06

Browse files
authored
feat(tracing): Move Integrations from tracing-internal to @sentry/tracing (#7471)
1 parent d27c347 commit 3269a06

File tree

3 files changed

+48
-31
lines changed

3 files changed

+48
-31
lines changed
Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,14 @@
11
export * from './exports';
22

3-
import { addExtensionMethods } from './extensions';
4-
import * as Integrations from './node/integrations';
5-
6-
export { Integrations };
7-
8-
// BrowserTracing is already exported as part of `Integrations` above (and for the moment will remain so for
9-
// backwards compatibility), but that interferes with treeshaking, so we also export it separately
10-
// here.
11-
//
12-
// Previously we expected users to import tracing integrations like
13-
//
14-
// import { Integrations } from '@sentry/tracing';
15-
// const instance = new Integrations.BrowserTracing();
16-
//
17-
// This makes the integrations unable to be treeshaken though. To address this, we now have
18-
// this individual export. We now expect users to consume BrowserTracing like so:
19-
//
20-
// import { BrowserTracing } from '@sentry/tracing';
21-
// const instance = new BrowserTracing();
22-
//
23-
// For an example of of the new usage of BrowserTracing, see @sentry/nextjs index.client.ts
24-
export { BrowserTracing } from './browser';
3+
export { Apollo, Express, GraphQL, Mongo, Mysql, Postgres, Prisma } from './node/integrations';
254

265
export {
6+
BrowserTracing,
277
BROWSER_TRACING_INTEGRATION_ID,
288
instrumentOutgoingRequests,
299
defaultRequestInstrumentationOptions,
3010
} from './browser';
3111

3212
export type { RequestInstrumentationOptions } from './browser';
3313

34-
export { addExtensionMethods };
14+
export { addExtensionMethods } from './extensions';

packages/tracing-internal/src/node/integrations/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,3 @@ export { Mongo } from './mongo';
55
export { Prisma } from './prisma';
66
export { GraphQL } from './graphql';
77
export { Apollo } from './apollo';
8-
9-
// TODO(v8): Remove this export
10-
// Please see `src/index.ts` for more details.
11-
export { BrowserTracing } from '../../browser';

packages/tracing/src/index.ts

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,49 @@
1-
export * from '@sentry-internal/tracing';
1+
export {
2+
// BrowserTracing is already exported as part of `Integrations` below (and for the moment will remain so for
3+
// backwards compatibility), but that interferes with treeshaking, so we also export it separately
4+
// here.
5+
BrowserTracing,
6+
BROWSER_TRACING_INTEGRATION_ID,
7+
IdleTransaction,
8+
Span,
9+
// eslint-disable-next-line deprecation/deprecation
10+
SpanStatus,
11+
TRACEPARENT_REGEXP,
12+
Transaction,
13+
addExtensionMethods,
14+
defaultRequestInstrumentationOptions,
15+
extractTraceparentData,
16+
instrumentOutgoingRequests,
17+
getActiveTransaction,
18+
hasTracingEnabled,
19+
spanStatusfromHttpCode,
20+
startIdleTransaction,
21+
stripUrlQueryAndFragment,
22+
} from '@sentry-internal/tracing';
23+
export type { RequestInstrumentationOptions, SpanStatusType } from '@sentry-internal/tracing';
224

3-
import { addExtensionMethods } from '@sentry-internal/tracing';
25+
import {
26+
addExtensionMethods,
27+
Apollo,
28+
BrowserTracing,
29+
Express,
30+
GraphQL,
31+
Mongo,
32+
Mysql,
33+
Postgres,
34+
Prisma,
35+
} from '@sentry-internal/tracing';
36+
37+
export const Integrations = {
38+
BrowserTracing: BrowserTracing,
39+
Apollo: Apollo,
40+
Express: Express,
41+
GraphQL: GraphQL,
42+
Mongo: Mongo,
43+
Mysql: Mysql,
44+
Postgres: Postgres,
45+
Prisma: Prisma,
46+
};
447

548
// Treeshakable guard to remove all code related to tracing
649
declare const __SENTRY_TRACING__: boolean;
@@ -10,5 +53,3 @@ if (typeof __SENTRY_TRACING__ === 'undefined' || __SENTRY_TRACING__) {
1053
// We are patching the global object with our hub extension methods
1154
addExtensionMethods();
1255
}
13-
14-
export { addExtensionMethods };

0 commit comments

Comments
 (0)