Skip to content

Commit 3ee810f

Browse files
committed
changes from review
1 parent 6e7f2c6 commit 3ee810f

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

packages/aws-serverless/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,6 @@ export { awsIntegration } from './integration/aws';
148148
export { awsLambdaIntegration } from './integration/awslambda';
149149

150150
export { getDefaultIntegrations, init } from './init';
151-
export { wrapHandler } from './sdk';
151+
// eslint-disable-next-line deprecation/deprecation
152+
export { tryPatchHandler, wrapHandler } from './sdk';
152153
export type { WrapperOptions } from './sdk';

packages/aws-serverless/src/integration/instrumentation-aws-lambda/instrumentation.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ import type { LambdaModule } from './internal-types';
5757
import { ATTR_FAAS_COLDSTART } from './semconv';
5858
import type { AwsLambdaInstrumentationConfig, EventContextExtractor } from './types';
5959
import { wrapHandler } from '../../sdk';
60+
import { SDK_VERSION } from '@sentry/core';
6061

61-
const PACKAGE_VERSION = '0.54.0';
62-
const PACKAGE_NAME = '@opentelemetry/instrumentation-aws-lambda';
62+
// OpenTelemetry package version was 0.54.0 at time of vendoring.
63+
const PACKAGE_VERSION = SDK_VERSION;
64+
const PACKAGE_NAME = '@sentry/instrumentation-aws-lambda';
6365

6466
const headerGetter: TextMapGetter<APIGatewayProxyEventHeaders> = {
6567
keys(carrier): string[] {

packages/aws-serverless/src/sdk.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,17 @@ function getRejectedReasons<T>(results: PromiseSettledResult<T>[]): T[] {
5959
}, []);
6060
}
6161

62+
/**
63+
* TODO(v11): Remove this function
64+
* @deprecated This function is no longer used and will be removed in a future major version.
65+
*/
66+
export function tryPatchHandler(_taskRoot: string, _handlerPath: string): void {
67+
consoleSandbox(() => {
68+
// eslint-disable-next-line no-console
69+
console.warn('The `tryPatchHandler` function is deprecated and will be removed in a future major version.');
70+
});
71+
}
72+
6273
/**
6374
* Tries to invoke context.getRemainingTimeInMillis if not available returns 0
6475
* Some environments use AWS lambda but don't support this function
@@ -200,6 +211,8 @@ export function wrapHandler<TEvent, TResult>(
200211
});
201212
}
202213
} catch (e) {
214+
// Errors should already captured in the instrumentation's `responseHook`,
215+
// we capture them here just to be safe. Double captures are deduplicated by the SDK.
203216
captureException(e, scope => markEventUnhandled(scope, 'auto.function.aws-serverless.handler'));
204217
throw e;
205218
} finally {

0 commit comments

Comments
 (0)