Skip to content

Commit b18c513

Browse files
committed
feat(v8/serverless): Remove deprecated exports
1 parent ca6010b commit b18c513

File tree

6 files changed

+24
-108
lines changed

6 files changed

+24
-108
lines changed

packages/serverless/src/awslambda.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
captureException,
99
captureMessage,
1010
continueTrace,
11-
defaultIntegrations as nodeDefaultIntegrations,
1211
flush,
1312
getCurrentScope,
1413
getDefaultIntegrations as getNodeDefaultIntegrations,
@@ -66,13 +65,6 @@ export interface WrapperOptions {
6665
startTrace: boolean;
6766
}
6867

69-
/** @deprecated Use `getDefaultIntegrations(options)` instead. */
70-
export const defaultIntegrations: Integration[] = [
71-
// eslint-disable-next-line deprecation/deprecation
72-
...nodeDefaultIntegrations,
73-
awsServicesIntegration({ optional: true }),
74-
];
75-
7668
/** Get the default integrations for the AWSLambda SDK. */
7769
export function getDefaultIntegrations(options: Options): Integration[] {
7870
return [...getNodeDefaultIntegrations(options), awsServicesIntegration({ optional: true })];

packages/serverless/src/awsservices.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, convertIntegrationFnToClass, defineIntegration } from '@sentry/core';
1+
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration } from '@sentry/core';
22
import { getClient, startInactiveSpan } from '@sentry/node';
3-
import type { Client, Integration, IntegrationClass, IntegrationFn, Span } from '@sentry/types';
3+
import type { Client, IntegrationFn, Span } from '@sentry/types';
44
import { fill } from '@sentry/utils';
55
// 'aws-sdk/global' import is expected to be type-only so it's erased in the final .js file.
66
// When TypeScript compiler is upgraded, use `import type` syntax to explicitly assert that we don't want to load a module here.
@@ -41,21 +41,10 @@ const _awsServicesIntegration = ((options: { optional?: boolean } = {}) => {
4141
};
4242
}) satisfies IntegrationFn;
4343

44-
export const awsServicesIntegration = defineIntegration(_awsServicesIntegration);
45-
4644
/**
4745
* AWS Service Request Tracking.
48-
*
49-
* @deprecated Use `awsServicesIntegration()` instead.
5046
*/
51-
// eslint-disable-next-line deprecation/deprecation
52-
export const AWSServices = convertIntegrationFnToClass(
53-
INTEGRATION_NAME,
54-
awsServicesIntegration,
55-
) as IntegrationClass<Integration>;
56-
57-
// eslint-disable-next-line deprecation/deprecation
58-
export type AWSServices = typeof AWSServices;
47+
export const awsServicesIntegration = defineIntegration(_awsServicesIntegration);
5948

6049
/**
6150
* Patches AWS SDK request to create `http.client` spans.

packages/serverless/src/gcpfunction/index.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import type { NodeOptions } from '@sentry/node';
2-
import {
3-
SDK_VERSION,
4-
defaultIntegrations as defaultNodeIntegrations,
5-
getDefaultIntegrations as getDefaultNodeIntegrations,
6-
init as initNode,
7-
} from '@sentry/node';
2+
import { SDK_VERSION, getDefaultIntegrations as getDefaultNodeIntegrations, init as initNode } from '@sentry/node';
83
import type { Integration, Options, SdkMetadata } from '@sentry/types';
94

105
import { googleCloudGrpcIntegration } from '../google-cloud-grpc';
@@ -14,14 +9,6 @@ export * from './http';
149
export * from './events';
1510
export * from './cloud_events';
1611

17-
/** @deprecated Use `getDefaultIntegrations(options)` instead. */
18-
export const defaultIntegrations: Integration[] = [
19-
// eslint-disable-next-line deprecation/deprecation
20-
...defaultNodeIntegrations,
21-
googleCloudHttpIntegration({ optional: true }), // We mark this integration optional since '@google-cloud/common' module could be missing.
22-
googleCloudGrpcIntegration({ optional: true }), // We mark this integration optional since 'google-gax' module could be missing.
23-
];
24-
2512
/** Get the default integrations for the GCP SDK. */
2613
export function getDefaultIntegrations(options: Options): Integration[] {
2714
return [

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

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import type { EventEmitter } from 'events';
2-
import {
3-
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
4-
convertIntegrationFnToClass,
5-
defineIntegration,
6-
getClient,
7-
} from '@sentry/core';
2+
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration, getClient } from '@sentry/core';
83
import { startInactiveSpan } from '@sentry/node';
9-
import type { Client, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
4+
import type { Client, IntegrationFn } from '@sentry/types';
105
import { fill } from '@sentry/utils';
116

127
interface GrpcFunction extends CallableFunction {
@@ -62,21 +57,10 @@ const _googleCloudGrpcIntegration = ((options: { optional?: boolean } = {}) => {
6257
};
6358
}) satisfies IntegrationFn;
6459

65-
export const googleCloudGrpcIntegration = defineIntegration(_googleCloudGrpcIntegration);
66-
6760
/**
6861
* Google Cloud Platform service requests tracking for GRPC APIs.
69-
*
70-
* @deprecated Use `googleCloudGrpcIntegration()` instead.
7162
*/
72-
// eslint-disable-next-line deprecation/deprecation
73-
export const GoogleCloudGrpc = convertIntegrationFnToClass(
74-
INTEGRATION_NAME,
75-
googleCloudGrpcIntegration,
76-
) as IntegrationClass<Integration>;
77-
78-
// eslint-disable-next-line deprecation/deprecation
79-
export type GoogleCloudGrpc = typeof GoogleCloudGrpc;
63+
export const googleCloudGrpcIntegration = defineIntegration(_googleCloudGrpcIntegration);
8064

8165
/** Returns a wrapped function that returns a stub with tracing enabled */
8266
function wrapCreateStub(origCreate: CreateStubFunc): CreateStubFunc {

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

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import type * as common from '@google-cloud/common';
2-
import {
3-
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
4-
convertIntegrationFnToClass,
5-
defineIntegration,
6-
getClient,
7-
} from '@sentry/core';
2+
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration, getClient } from '@sentry/core';
83
import { startInactiveSpan } from '@sentry/node';
9-
import type { Client, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
4+
import type { Client, IntegrationFn } from '@sentry/types';
105
import { fill } from '@sentry/utils';
116

127
type RequestOptions = common.DecorateRequestOptions;
@@ -41,21 +36,10 @@ const _googleCloudHttpIntegration = ((options: { optional?: boolean } = {}) => {
4136
};
4237
}) satisfies IntegrationFn;
4338

44-
export const googleCloudHttpIntegration = defineIntegration(_googleCloudHttpIntegration);
45-
4639
/**
4740
* Google Cloud Platform service requests tracking for RESTful APIs.
48-
*
49-
* @deprecated Use `googleCloudHttpIntegration()` instead.
5041
*/
51-
// eslint-disable-next-line deprecation/deprecation
52-
export const GoogleCloudHttp = convertIntegrationFnToClass(
53-
INTEGRATION_NAME,
54-
googleCloudHttpIntegration,
55-
) as IntegrationClass<Integration>;
56-
57-
// eslint-disable-next-line deprecation/deprecation
58-
export type GoogleCloudHttp = typeof GoogleCloudHttp;
42+
export const googleCloudHttpIntegration = defineIntegration(_googleCloudHttpIntegration);
5943

6044
/** Returns a wrapped function that makes a request with tracing enabled */
6145
function wrapRequestFunction(orig: RequestFunction): RequestFunction {

packages/serverless/src/index.ts

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
// https://medium.com/unsplash/named-namespace-imports-7345212bbffb
2-
import * as AWSLambda from './awslambda';
3-
import * as GCPFunction from './gcpfunction';
4-
export { AWSLambda, GCPFunction };
1+
export { awsServicesIntegration } from './awsservices';
2+
3+
import { init as awsLambdaInit, wrapHandler } from './awslambda';
4+
import { init as gcpFunctionInit } from './gcpfunction';
5+
6+
const AWSLambda = {
7+
init: awsLambdaInit,
8+
wrapHandler,
9+
};
510

6-
// eslint-disable-next-line deprecation/deprecation
7-
export { AWSServices, awsServicesIntegration } from './awsservices';
11+
const GCPFunction = {
12+
init: gcpFunctionInit,
13+
};
14+
15+
export { AWSLambda, GCPFunction };
816

917
// TODO(v8): We have to explicitly export these because of the namespace exports
1018
// above. This is because just doing `export * from '@sentry/node'` will not
@@ -15,8 +23,6 @@ export {
1523
SDK_VERSION,
1624
Scope,
1725
addBreadcrumb,
18-
// eslint-disable-next-line deprecation/deprecation
19-
addGlobalEventProcessor,
2026
addEventProcessor,
2127
addIntegration,
2228
autoDiscoverNodePerformanceMonitoringIntegrations,
@@ -25,61 +31,39 @@ export {
2531
captureMessage,
2632
captureCheckIn,
2733
withMonitor,
28-
// eslint-disable-next-line deprecation/deprecation
29-
configureScope,
3034
createTransport,
31-
// eslint-disable-next-line deprecation/deprecation
32-
getActiveTransaction,
33-
// eslint-disable-next-line deprecation/deprecation
34-
getCurrentHub,
3535
getClient,
3636
isInitialized,
3737
getCurrentScope,
3838
getGlobalScope,
3939
getIsolationScope,
4040
getHubFromCarrier,
41-
// eslint-disable-next-line deprecation/deprecation
42-
spanStatusfromHttpCode,
4341
getSpanStatusFromHttpCode,
4442
setHttpStatus,
45-
// eslint-disable-next-line deprecation/deprecation
46-
makeMain,
4743
setCurrentClient,
4844
setContext,
4945
setExtra,
5046
setExtras,
5147
setTag,
5248
setTags,
5349
setUser,
54-
// eslint-disable-next-line deprecation/deprecation
55-
startTransaction,
5650
withScope,
5751
withIsolationScope,
5852
NodeClient,
5953
makeNodeTransport,
6054
close,
61-
// eslint-disable-next-line deprecation/deprecation
62-
defaultIntegrations,
6355
getDefaultIntegrations,
6456
defaultStackParser,
6557
flush,
6658
getSentryRelease,
6759
init,
68-
// eslint-disable-next-line deprecation/deprecation
69-
lastEventId,
7060
DEFAULT_USER_INCLUDES,
7161
addRequestDataToEvent,
7262
extractRequestData,
73-
// eslint-disable-next-line deprecation/deprecation
74-
deepReadDirSync,
7563
Handlers,
76-
// eslint-disable-next-line deprecation/deprecation
77-
Integrations,
7864
setMeasurement,
7965
getActiveSpan,
8066
startSpan,
81-
// eslint-disable-next-line deprecation/deprecation
82-
startActiveSpan,
8367
startInactiveSpan,
8468
startSpanManual,
8569
continueTrace,
@@ -88,12 +72,8 @@ export {
8872
linkedErrorsIntegration,
8973
inboundFiltersIntegration,
9074
functionToStringIntegration,
91-
// eslint-disable-next-line deprecation/deprecation
92-
getModuleFromFilename,
9375
createGetModuleFromFilename,
9476
metrics,
95-
// eslint-disable-next-line deprecation/deprecation
96-
extractTraceparentData,
9777
runWithAsyncContext,
9878
consoleIntegration,
9979
onUncaughtExceptionIntegration,

0 commit comments

Comments
 (0)