Skip to content

Commit ba931a7

Browse files
committed
add modification notice
1 parent dbb48b7 commit ba931a7

File tree

2 files changed

+14
-23
lines changed

2 files changed

+14
-23
lines changed

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
// Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/cc7eff47e2e7bad7678241b766753d5bd6dbc85f/packages/instrumentation-aws-lambda/src/instrumentation.ts
1+
// Vendored and modified from: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/cc7eff47e2e7bad7678241b766753d5bd6dbc85f/packages/instrumentation-aws-lambda/src/instrumentation.ts
2+
// Modifications:
3+
// - Added Sentry `wrapHandler` around the OTel patch handler.
4+
// - Cancel init when handler string is invalid (TS)
5+
// - Hardcoded package version and name
26
/* eslint-disable */
37
/*
48
* Copyright The OpenTelemetry Authors
@@ -52,10 +56,11 @@ import * as path from 'path';
5256
import type { LambdaModule } from './internal-types';
5357
import { ATTR_FAAS_COLDSTART } from './semconv';
5458
import type { AwsLambdaInstrumentationConfig, EventContextExtractor } from './types';
55-
/** @knipignore */
56-
import { PACKAGE_NAME, PACKAGE_VERSION } from './version';
5759
import { wrapHandler } from '../../sdk';
5860

61+
const PACKAGE_VERSION = '0.54.0';
62+
const PACKAGE_NAME = '@opentelemetry/instrumentation-aws-lambda';
63+
5964
const headerGetter: TextMapGetter<APIGatewayProxyEventHeaders> = {
6065
keys(carrier): string[] {
6166
return Object.keys(carrier);
@@ -100,7 +105,12 @@ export class AwsLambdaInstrumentation extends InstrumentationBase<AwsLambdaInstr
100105
const [module, functionName] = handler.split('.', 2);
101106

102107
if (!module || !functionName) {
103-
throw new Error('Invalid handler definition');
108+
this._diag.warn('Invalid handler definition', {
109+
handler,
110+
moduleRoot,
111+
module,
112+
});
113+
return [];
104114
}
105115

106116
// Lambda loads user function using an absolute path.

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

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

0 commit comments

Comments
 (0)