Skip to content

Commit c395e4c

Browse files
committed
ref(tracing): Re-organize exports for node/browser
1 parent 77a810d commit c395e4c

File tree

15 files changed

+47
-36
lines changed

15 files changed

+47
-36
lines changed

packages/tracing/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@sentry/tracing",
33
"version": "7.41.0",
4-
"description": "Extensions for Sentry AM",
4+
"description": "Sentry Performance Monitoring Package",
55
"repository": "git://github.com/getsentry/sentry-javascript.git",
66
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/tracing",
77
"author": "Sentry",

packages/tracing/src/browser/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export * from '../exports';
2+
13
export type { RequestInstrumentationOptions } from './request';
24

35
export { BrowserTracing, BROWSER_TRACING_INTEGRATION_ID } from './browsertracing';

packages/tracing/src/exports/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export {
2+
extractTraceparentData,
3+
getActiveTransaction,
4+
hasTracingEnabled,
5+
IdleTransaction,
6+
Span,
7+
// eslint-disable-next-line deprecation/deprecation
8+
SpanStatus,
9+
spanStatusfromHttpCode,
10+
startIdleTransaction,
11+
stripUrlQueryAndFragment,
12+
TRACEPARENT_REGEXP,
13+
Transaction,
14+
} from '@sentry/core';
15+
export type { SpanStatusType } from '@sentry/core';

packages/tracing/src/extensions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ function _autoloadDatabaseIntegrations(): void {
1515

1616
const packageToIntegrationMapping: Record<string, () => Integration> = {
1717
mongodb() {
18-
const integration = dynamicRequire(module, './integrations/node/mongo') as {
18+
const integration = dynamicRequire(module, './node/integrations/mongo') as {
1919
Mongo: IntegrationClass<Integration>;
2020
};
2121
return new integration.Mongo();
2222
},
2323
mongoose() {
24-
const integration = dynamicRequire(module, './integrations/node/mongo') as {
24+
const integration = dynamicRequire(module, './node/integrations/mongo') as {
2525
Mongo: IntegrationClass<Integration>;
2626
};
2727
return new integration.Mongo({ mongoose: true });
2828
},
2929
mysql() {
30-
const integration = dynamicRequire(module, './integrations/node/mysql') as {
30+
const integration = dynamicRequire(module, './node/integrations/mysql') as {
3131
Mysql: IntegrationClass<Integration>;
3232
};
3333
return new integration.Mysql();
3434
},
3535
pg() {
36-
const integration = dynamicRequire(module, './integrations/node/postgres') as {
36+
const integration = dynamicRequire(module, './node/integrations/postgres') as {
3737
Postgres: IntegrationClass<Integration>;
3838
};
3939
return new integration.Postgres();

packages/tracing/src/index.ts

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,7 @@
1-
export {
2-
extractTraceparentData,
3-
getActiveTransaction,
4-
hasTracingEnabled,
5-
IdleTransaction,
6-
Span,
7-
// eslint-disable-next-line deprecation/deprecation
8-
SpanStatus,
9-
spanStatusfromHttpCode,
10-
startIdleTransaction,
11-
stripUrlQueryAndFragment,
12-
TRACEPARENT_REGEXP,
13-
Transaction,
14-
} from '@sentry/core';
15-
export type { SpanStatusType } from '@sentry/core';
1+
export * from './exports';
162

173
import { addExtensionMethods } from './extensions';
18-
import * as Integrations from './integrations';
19-
20-
export type { RequestInstrumentationOptions } from './browser';
4+
import * as Integrations from './node';
215

226
export { Integrations };
237

@@ -37,9 +21,14 @@ export { Integrations };
3721
// const instance = new BrowserTracing();
3822
//
3923
// For an example of of the new usage of BrowserTracing, see @sentry/nextjs index.client.ts
40-
export { BrowserTracing, BROWSER_TRACING_INTEGRATION_ID } from './browser';
24+
export {
25+
BrowserTracing,
26+
BROWSER_TRACING_INTEGRATION_ID,
27+
instrumentOutgoingRequests,
28+
defaultRequestInstrumentationOptions,
29+
} from './browser';
4130

42-
export { instrumentOutgoingRequests, defaultRequestInstrumentationOptions } from './browser';
31+
export type { RequestInstrumentationOptions } from './browser';
4332

4433
// Treeshakable guard to remove all code related to tracing
4534
declare const __SENTRY_TRACING__: boolean;

packages/tracing/src/integrations/index.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/tracing/src/node/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export * from '../exports';
2+
3+
export { Express } from './integrations/express';
4+
export { Postgres } from './integrations/postgres';
5+
export { Mysql } from './integrations/mysql';
6+
export { Mongo } from './integrations/mongo';
7+
export { Prisma } from './integrations/prisma';
8+
export { GraphQL } from './integrations/graphql';
9+
export { Apollo } from './integrations/apollo';
10+
11+
// TODO(v7): Remove this export
12+
// Please see `src/index.ts` for more details.
13+
export { BrowserTracing } from '../browser';

packages/tracing/src/integrations/node/apollo.ts renamed to packages/tracing/src/node/integrations/apollo.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @sentry-internal/sdk/no-optional-chaining */
2+
13
import type { Hub } from '@sentry/core';
24
import type { EventProcessor, Integration } from '@sentry/types';
35
import { arrayify, fill, isThenable, loadModule, logger } from '@sentry/utils';

packages/tracing/src/integrations/node/utils/node-utils.ts renamed to packages/tracing/src/node/integrations/utils/node-utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @sentry-internal/sdk/no-optional-chaining */
12
import type { Hub } from '@sentry/types';
23

34
/**

0 commit comments

Comments
 (0)