{"_id":"@coralogix/instrumentation-aws-lambda","_rev":"6-1fd2b761bf5e561211e092e3ce101649","name":"@coralogix/instrumentation-aws-lambda","dist-tags":{"latest":"0.72.0"},"versions":{"0.61.0":{"name":"@coralogix/instrumentation-aws-lambda","version":"0.61.0","keywords":["aws-lambda","instrumentation","nodejs","opentelemetry","profiling","tracing"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","_id":"@coralogix/instrumentation-aws-lambda@0.61.0","maintainers":[{"name":"coralogixnpm","email":"npm@coralogix.com"}],"homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-aws-lambda#readme","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js-contrib/issues"},"dist":{"shasum":"d5b7fb03b3abd8c531fae9168d14a6f0da4b6807","tarball":"https://registry.npmjs.org/@coralogix/instrumentation-aws-lambda/-/instrumentation-aws-lambda-0.61.0.tgz","fileCount":3,"integrity":"sha512-pLn92IWaql/ZNBDsWilhYFRgWUUr3QTx+pVsDv6x1O4rKUO42SiizfzBADDmAmdEVIlLSVcbolWmUejoSsOb8A==","signatures":[{"sig":"MEUCIB0lsyfgVQZFZ6N8DZNdPRjjAqVoM87MmsC3j05qBFDEAiEAsHVKAxPm1we/a6ashVkGlRxeJmfD39xwR1Kyt4EDkrs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27091},"main":"build/src/index.js","types":"build/src/index.d.ts","engines":{"node":"^18.19.0 || >=20.6.0"},"gitHead":"b34b62b38f8a9e1439954dc1c2166437aabb863f","scripts":{"tdd":"npm run test -- --watch-extensions ts --watch","test":"nyc --no-clean mocha 'test/**/*.test.ts'","clean":"rimraf build/*","compile":"tsc -p .","lint:readme":"node ../../scripts/lint-readme.js","prepublishOnly":"npm run compile","version:update":"node ../../scripts/version-update.js","compile:with-dependencies":"nx run-many -t compile -p @opentelemetry/instrumentation-aws-lambda"},"_npmUser":{"name":"coralogixnpm","email":"npm@coralogix.com"},"repository":{"url":"git+https://github.com/open-telemetry/opentelemetry-js-contrib.git","type":"git","directory":"packages/instrumentation-aws-lambda"},"_npmVersion":"10.8.2","description":"OpenTelemetry instrumentation for AWS Lambda function invocations","directories":{},"_nodeVersion":"18.20.8","dependencies":{"@types/aws-lambda":"^8.10.155","@opentelemetry/instrumentation":"npm:@coralogix/instrumentation@^0.208.0","@opentelemetry/propagator-aws-xray":"^2.1.1","@opentelemetry/semantic-conventions":"^1.27.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@opentelemetry/api":"^1.3.0","@opentelemetry/core":"^2.0.0","@opentelemetry/sdk-metrics":"^2.0.0","@opentelemetry/sdk-trace-base":"^2.0.0","@opentelemetry/sdk-trace-node":"^2.0.0","@opentelemetry/propagator-aws-xray":"^2.1.4","@opentelemetry/propagator-aws-xray-lambda":"^0.55.4"},"peerDependencies":{"@opentelemetry/api":"^1.3.0"},"_npmOperationalInternal":{"tmp":"tmp/instrumentation-aws-lambda_0.61.0_1769019826299_0.01956478586760202","host":"s3://npm-registry-packages-npm-production"}},"0.61.1":{"name":"@coralogix/instrumentation-aws-lambda","version":"0.61.1","keywords":["aws-lambda","instrumentation","nodejs","opentelemetry","profiling","tracing"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","_id":"@coralogix/instrumentation-aws-lambda@0.61.1","maintainers":[{"name":"coralogixnpm","email":"npm@coralogix.com"}],"homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-aws-lambda#readme","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js-contrib/issues"},"dist":{"shasum":"6c7d1bb1a51d82f9f396cb0142b88547124ac7b7","tarball":"https://registry.npmjs.org/@coralogix/instrumentation-aws-lambda/-/instrumentation-aws-lambda-0.61.1.tgz","fileCount":69,"integrity":"sha512-0JCGUsxUPhyxpv2n1vQxYeocA5ruHUeDowx5LUTAeHVHh5LH9kLVEjIdKvJ4ldYIo5o92ib+qikyzAj54+V7XQ==","signatures":[{"sig":"MEUCIAmWGs/5QCrPg7N304CqmB+Z5Z4XrqnMwW0aS3nwetf5AiEAyg77oY2L8tejKkyAj+58BUsPujxXB/1egbYlWMgRPYY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":228135},"main":"build/src/index.js","types":"build/src/index.d.ts","engines":{"node":"^18.19.0 || >=20.6.0"},"gitHead":"3c61bdf9c30ecf4419d5c995c7f24ef9107c936f","scripts":{"tdd":"npm run test -- --watch-extensions ts --watch","test":"nyc --no-clean mocha 'test/**/*.test.ts'","clean":"rimraf build/*","compile":"tsc -p .","lint:readme":"node ../../scripts/lint-readme.js","prepublishOnly":"npm run compile","version:update":"node ../../scripts/version-update.js","compile:with-dependencies":"nx run-many -t compile -p @opentelemetry/instrumentation-aws-lambda"},"_npmUser":{"name":"coralogixnpm","email":"npm@coralogix.com"},"repository":{"url":"git+https://github.com/open-telemetry/opentelemetry-js-contrib.git","type":"git","directory":"packages/instrumentation-aws-lambda"},"_npmVersion":"10.8.2","description":"OpenTelemetry instrumentation for AWS Lambda function invocations","directories":{},"_nodeVersion":"20.19.6","dependencies":{"@types/aws-lambda":"^8.10.155","@opentelemetry/instrumentation":"npm:@coralogix/instrumentation@^0.208.0","@opentelemetry/propagator-aws-xray":"^2.1.1","@opentelemetry/semantic-conventions":"^1.27.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@opentelemetry/api":"^1.3.0","@opentelemetry/core":"^2.0.0","@opentelemetry/sdk-metrics":"^2.0.0","@opentelemetry/sdk-trace-base":"^2.0.0","@opentelemetry/sdk-trace-node":"^2.0.0","@opentelemetry/propagator-aws-xray":"^2.1.4","@opentelemetry/propagator-aws-xray-lambda":"^0.55.4"},"peerDependencies":{"@opentelemetry/api":"^1.3.0"},"_npmOperationalInternal":{"tmp":"tmp/instrumentation-aws-lambda_0.61.1_1769088377877_0.4643428839195112","host":"s3://npm-registry-packages-npm-production"}},"0.65.0":{"name":"@coralogix/instrumentation-aws-lambda","version":"0.65.0","keywords":["aws-lambda","instrumentation","nodejs","opentelemetry","profiling","tracing"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","_id":"@coralogix/instrumentation-aws-lambda@0.65.0","maintainers":[{"name":"coralogixnpm","email":"npm@coralogix.com"}],"homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-aws-lambda#readme","bugs":{"url":"https://github.com/open-telemetry/opentelemetry-js-contrib/issues"},"dist":{"shasum":"7e248156501332b09096d55806eb56dd88b5c593","tarball":"https://registry.npmjs.org/@coralogix/instrumentation-aws-lambda/-/instrumentation-aws-lambda-0.65.0.tgz","fileCount":69,"integrity":"sha512-BTTg1K/a1vpAV57xeWxWYJv4JEf6vkmWxf/NJQLlJfYcs+yzcunle2SV+e0c/xB0U5X0sPEmqSmHIMrRAPe9Rg==","signatures":[{"sig":"MEQCIB5DDUZZu/c0ZppojCaBf++eCtpx9PiUVoR1hc11J7FzAiAMpLQz5OnKvAuWXERlkIUmLXkO9VJOMD/bS0HqNzIM/w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":228135},"main":"build/src/index.js","types":"build/src/index.d.ts","engines":{"node":"^18.19.0 || >=20.6.0"},"gitHead":"3a9691a699ddd06c3644eec70bf4b50cc4217ba3","scripts":{"tdd":"npm run test -- --watch-extensions ts --watch","test":"nyc --no-clean mocha 'test/**/*.test.ts'","clean":"rimraf build/*","compile":"tsc -p .","lint:readme":"node ../../scripts/lint-readme.js","prepublishOnly":"npm run compile","version:update":"node ../../scripts/version-update.js","compile:with-dependencies":"nx run-many -t compile -p @opentelemetry/instrumentation-aws-lambda"},"_npmUser":{"name":"coralogixnpm","email":"npm@coralogix.com"},"repository":{"url":"git+https://github.com/open-telemetry/opentelemetry-js-contrib.git","type":"git","directory":"packages/instrumentation-aws-lambda"},"_npmVersion":"10.8.2","description":"OpenTelemetry instrumentation for AWS Lambda function invocations","directories":{},"_nodeVersion":"20.20.0","dependencies":{"@types/aws-lambda":"^8.10.155","@opentelemetry/instrumentation":"npm:@coralogix/instrumentation@^0.213.0","@opentelemetry/propagator-aws-xray":"^2.2.0","@opentelemetry/semantic-conventions":"^1.27.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@opentelemetry/api":"^1.3.0","@opentelemetry/core":"^2.0.0","@opentelemetry/sdk-metrics":"^2.0.0","@opentelemetry/sdk-trace-base":"^2.0.0","@opentelemetry/sdk-trace-node":"^2.0.0","@opentelemetry/propagator-aws-xray":"^2.2.0","@opentelemetry/propagator-aws-xray-lambda":"^0.56.0"},"peerDependencies":{"@opentelemetry/api":"^1.3.0"},"_npmOperationalInternal":{"tmp":"tmp/instrumentation-aws-lambda_0.65.0_1773311983158_0.6694119640922671","host":"s3://npm-registry-packages-npm-production"}},"0.72.0":{"name":"@coralogix/instrumentation-aws-lambda","version":"0.72.0","description":"OpenTelemetry instrumentation for AWS Lambda function invocations","main":"build/src/index.js","types":"build/src/index.d.ts","repository":{"type":"git","url":"git+https://github.com/coralogix/opentelemetry-js-contrib.git","directory":"packages/instrumentation-aws-lambda"},"scripts":{"clean":"rimraf build/*","compile":"tsc -p .","compile:with-dependencies":"nx run-many -t compile -p @opentelemetry/instrumentation-aws-lambda","lint:readme":"node ../../scripts/lint-readme.js","prepublishOnly":"npm run compile","tdd":"npm run test -- --watch-extensions ts --watch","test":"nyc --no-clean mocha 'test/**/*.test.ts'","version:update":"node ../../scripts/version-update.js"},"keywords":["aws-lambda","instrumentation","nodejs","opentelemetry","profiling","tracing"],"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","engines":{"node":"^18.19.0 || >=20.6.0"},"publishConfig":{"access":"public"},"peerDependencies":{"@opentelemetry/api":"^1.3.0"},"devDependencies":{"@opentelemetry/api":"^1.3.0","@opentelemetry/core":"^2.0.0","@opentelemetry/propagator-aws-xray-lambda":"^0.56.0","@opentelemetry/sdk-metrics":"^2.0.0","@opentelemetry/sdk-trace-base":"^2.0.0","@opentelemetry/sdk-trace-node":"^2.0.0"},"dependencies":{"@opentelemetry/instrumentation":"npm:@coralogix/instrumentation@^0.220.0","@opentelemetry/propagator-aws-xray":"^2.2.0","@opentelemetry/semantic-conventions":"^1.27.0","@types/aws-lambda":"^8.10.155"},"homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-aws-lambda#readme","gitHead":"0bba7e6f2845a99b751108ac423460014dc844f4","_id":"@coralogix/instrumentation-aws-lambda@0.72.0","bugs":{"url":"https://github.com/coralogix/opentelemetry-js-contrib/issues"},"_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-W5q9tH7ruZ96X5jbwS+M6hm/EMOx4U7jiTaTJgi7pSpxJiOQPkVS4lrkaWNISeuDwH+0idCb981kk3TTv6t2Eg==","shasum":"c2411ced76af43fd7e36eec30a743f02b0eb1653","tarball":"https://registry.npmjs.org/@coralogix/instrumentation-aws-lambda/-/instrumentation-aws-lambda-0.72.0.tgz","fileCount":72,"unpackedSize":253859,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@coralogix%2finstrumentation-aws-lambda@0.72.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQClkYx5GCuzoatRGFANprgtBbHjNqyI1q8IKuZzX/4JvgIhANpz80Exp3+KPQVVXuXnuI2tk8OIQccXHlkplSF9fdps"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:caa457be-6da0-4d9d-bc4f-69cac3d935a6"}},"directories":{},"maintainers":[{"name":"coralogixnpm","email":"npm@coralogix.com"},{"name":"ashley-hunter-cx","email":"ashley.hunter@coralogix.com"},{"name":"cx-shaharkazaz","email":"shahar.kazaz@coralogix.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/instrumentation-aws-lambda_0.72.0_1783100948354_0.752595840413828"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-21T18:23:46.193Z","modified":"2026-07-03T17:49:08.838Z","0.61.0":"2026-01-21T18:23:46.465Z","0.61.1":"2026-01-22T13:26:18.049Z","0.65.0":"2026-03-12T10:39:43.310Z","0.72.0":"2026-07-03T17:49:08.487Z"},"bugs":{"url":"https://github.com/coralogix/opentelemetry-js-contrib/issues"},"author":{"name":"OpenTelemetry Authors"},"license":"Apache-2.0","homepage":"https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-aws-lambda#readme","keywords":["aws-lambda","instrumentation","nodejs","opentelemetry","profiling","tracing"],"repository":{"type":"git","url":"git+https://github.com/coralogix/opentelemetry-js-contrib.git","directory":"packages/instrumentation-aws-lambda"},"description":"OpenTelemetry instrumentation for AWS Lambda function invocations","maintainers":[{"name":"coralogixnpm","email":"npm@coralogix.com"},{"name":"ashley-hunter-cx","email":"ashley.hunter@coralogix.com"},{"name":"cx-shaharkazaz","email":"shahar.kazaz@coralogix.com"}],"readme":"# OpenTelemetry AWS Lambda Instrumentation for Node.js\n\n[![NPM Published Version][npm-img]][npm-url]\n[![Apache License][license-image]][license-image]\n\n[component owners](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/.github/component_owners.yml): @jj22ee\n\nThis module provides automatic instrumentation for the [`AWS Lambda`](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html) module, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package and is included in the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle.\n\nIf total installation size is not constrained, it is recommended to use the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle with [@opentelemetry/sdk-node](`https://www.npmjs.com/package/@opentelemetry/sdk-node`) for the most seamless instrumentation experience.\n\nCompatible with OpenTelemetry JS API and SDK `1.0+`.\n\nThis module is currently under active development and not ready for general use.\n\n## Installation\n\n```bash\nnpm install --save @opentelemetry/instrumentation-aws-lambda\n```\n\n## Supported Versions\n\n- This package will instrument the lambda execution regardless of versions.\n\n## Important Notes\n\n### Handler Types Supported\n\nThis instrumentation automatically detects the Node.js runtime version and supports handlers accordingly:\n\n- **Node.js 24+**: Only Promise-based handlers are supported (callbacks are deprecated by AWS Lambda)\n- **Node.js 22 and lower**: Both callback-based and Promise-based handlers are supported for backward compatibility\n\nThe instrumentation detects the runtime version from the `AWS_EXECUTION_ENV` environment variable and adapts the handler signature accordingly. For Node.js 24+, the handler signature is `(event, context)`, while for Node.js 22 and lower, it supports both `(event, context, callback)` and `(event, context)`.\n\nExample handlers:\n\n```js\n// Callback-based handler (Node.js 22 and lower only)\nexports.handler = function(event, context, callback) {\n  callback(null, 'ok');\n};\n\n// Promise-based handler (all Node.js versions)\nexport const handler = async (event, context) => {\n  return 'ok';\n};\n```\n\n**Note**: AWS Lambda has removed callback-based handlers in Node.js 24 runtime. It's required to migrate to Promise-based handlers when upgrading to Node.js 24+.\n\n### ES Module hook required for Node.js 24+ AWS Lambda runtimes\n\nA change in the AWS Lambda runtime for Node.js 24 is that the user handler module is now loaded with `await import(...)` rather than `require(...)`.\nThis means that **OpenTelemetry's ECMAScript Module (ESM) hook must be enabled for instrumentation of AWS Lambda functions using the Node.js 24+ runtime.**\nThis can be done either by:\n\n1. Adding `--experimental-loader=@opentelemetry/instrumentation/hook.mjs` to the `NODE_OPTIONS` environment variable, or\n\n2. loading the same hook via [`module.register(...)`](https://nodejs.org/api/all.html#moduleregisterspecifier-parenturl-options)\n    before the Lambda handler module is loaded.\n    For example, create a file \"register-hook.mjs\" next to your handler module:\n\n    ```js\n    // register-hook.mjs\n    import {register} from 'node:module';\n    register('./hook.mjs', import.meta.url);\n    ```\n\n    and add `--import=/var/task/register-hook.mjs` to the `NODE_OPTIONS` environment variable. This same `register-hook.mjs` could be used for other OpenTelemetry initialization.\n\n## Usage\n\nCreate a file to initialize the instrumentation, such as `lambda-wrapper.js`.\n\n```js\nconst { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');\nconst { AwsLambdaInstrumentation } = require('@opentelemetry/instrumentation-aws-lambda');\nconst { registerInstrumentations } = require('@opentelemetry/instrumentation');\n\nconst provider = new NodeTracerProvider();\nprovider.register();\n\nregisterInstrumentations({\n  instrumentations: [\n    new AwsLambdaInstrumentation({\n        // see under for available configuration\n    })\n  ],\n});\n```\n\nIn your Lambda function configuration, add or update the `NODE_OPTIONS` environment variable to require the wrapper, e.g.,\n\n`NODE_OPTIONS=--require lambda-wrapper`\n\n## AWS Lambda Instrumentation Options\n\n| Options | Type | Description |\n|---------|------|-------------|\n| `requestHook` | `RequestHook` (function) | Hook for adding custom attributes before lambda starts handling the request. Receives params: `span, { event, context }` |\n| `responseHook` | `ResponseHook` (function) | Hook for adding custom attributes before lambda returns the response. Receives params: `span, { err?, res? }` |\n| `eventContextExtractor` | `EventContextExtractor` (function) | Function for providing custom context extractor in order to support different event types that are handled by AWS Lambda (e.g., SQS, CloudWatch, Kinesis, API Gateway). |\n| `lambdaHandler` | `string` | By default, this instrumentation automatically determines the Lambda handler function to instrument. This option is used to override that behavior by explicitly specifying the Lambda handler to instrument. See [Specifying the Lambda Handler](#specifying-the-lambda-handler) for additional information. |\n| `useGlobalPropagatorForSqsExtraction` | `boolean` | By default for SQS messages, this instrumentation uses the AWS X-Ray propagator to extract context from `systemAttributes` which is spec-compliant. This option can be set to `true` to override that behavior, meaning context will be extracted from `messageAttributes` using the configured propagator. The latter deviates from the spec but can be useful when your producer injects context into `messageAttributes`. |\n\n### Hooks Usage Example\n\n```js\nconst { AwsLambdaInstrumentation } = require('@opentelemetry/instrumentation-aws-lambda');\n\nnew AwsLambdaInstrumentation({\n    requestHook: (span, { event, context }) => {\n        span.setAttribute('faas.name', context.functionName);\n    },\n    responseHook: (span, { err, res }) => {\n        if (err instanceof Error) span.setAttribute('faas.error', err.message);\n        if (res) span.setAttribute('faas.res', res);\n    }\n})\n```\n\n### Specifying the Lambda Handler\n\nThe instrumentation will attempt to automatically determine the Lambda handler function to instrument. To do this, it relies on the `_HANDLER` environment variable which is [set by the Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime). For most use cases, this will accurately represent the handler that should be targeted by this instrumentation.\n\nThere exist use cases where the `_HANDLER` environment variable does not accurately represent the module that should be targeted by this instrumentation. For these use cases, the `lambdaHandler` option can be used to explicitly specify the Lambda handler that should be instrumented.\n\nTo better explain when `lambdaHandler` should be specified, consider how some telemetry tools, such as [Datadog](https://www.datadoghq.com/), are instrumented into the Lambda runtime. Datadog does this by overriding the handler function with a wrapper function that is loaded via a [Lambda Layer](https://docs.aws.amazon.com/lambda/latest/dg/chapter-layers.html). In these examples, the Lambda's handler will point to the Datadog wrapper and not to the actual handler that should be instrumented. In cases like this, `lambdaHandler` should be used to explicitly specify the handler that should be instrumented.\n\nThe `lambdaHandler` should be specified as a string in the format `<file>.<handler>`, where `<file>` is the name of the file that contains the handler and `<handler>` is the name of the handler function. For example, if the handler is defined in the file `index.js` and the handler function is named `handler`, the `lambdaHandler` should be specified as `index.handler`.\n\nOne way to determine if the `lambdaHandler` option should be used is to check the handler defined on your Lambda. This can be done by determining the value of the `_HANDLER` environment variable or by viewing the **Runtime Settings** of your Lambda in AWS Console. If the handler is what you expect, then the instrumentation should work without the `lambdaHandler` option. If the handler points to something else, then the `lambdaHandler` option should be used to explicitly specify the handler that should be instrumented.\n\n### Context Propagation\n\nAWS Active Tracing can provide a parent context for the span generated by this instrumentation. Note that the span generated by Active Tracing is always reported only to AWS X-Ray. Therefore, if the OpenTelemetry SDK is configured to export traces to a backend other than AWS X-Ray, this will result in a broken trace.\n\nIf you use version `<=0.46.0` of this package, then the Active Tracing context is used as the parent context by default if present. In this case, in order to prevent broken traces, set the `disableAwsContextPropagation` option to `false`.\nAdditional propagators can be added in the TracerProvider configuration.\n\nIf you use version `>0.46.0`, the Active Tracing context is no longer used by default. In order to enable it, include the [AWSXRayLambdaPropagator](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/propagator-aws-xray-lambda) propagator in the list of propagators provided to the TracerProvider via its configuration, or by including `xray-lambda` in the OTEL_PROPAGATORS environment variable (see the example below on using the env variable).\n\nNote that there are two AWS-related propagators: [AWSXRayPropagator](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/propagator-aws-xray) and [AWSXRayLambdaPropagator](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/propagator-aws-xray-lambda). Here is a guideline for when to use one or the other:\n\n- If you export traces to AWS X-Ray, then use the `AWSXRayLambdaPropagator` or the `xray-lambda` value in the OTEL_PROPAGATORS environment variable. This will handle the active tracing lambda context as well as X-Ray HTTP headers.\n- If you export traces to a backend other than AWS X-Ray, then use the `AWSXrayPropagator` or `xray` in the environment variable. This propagator only handles the X-Ray HTTP headers.\n\nExamples:\n\n1. Active Tracing is enabled and the OpenTelemetry SDK is configured to export traces to AWS X-Ray. In this case, configure the SDK to use the `AWSXRayLambdaPropagator`.\n\n```js\nconst { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');\nconst { AWSXRayLambdaPropagator } = require('@opentelemetry/propagator-aws-xray-lambda');\n\nconst provider = new NodeTracerProvider();\nprovider.register({\n  propagator: new AWSXRayLambdaPropagator()\n});\n```\n\nAlternatively, use the `getPropagators()` function from the [auto-configuration-propagators](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/packages/auto-configuration-propagators/README.md) package, and set the OTEL_PROPAGATORS environment variable to `xray-lambda`.\n\n```js\nconst { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');\nconst { getPropagator } = require('@opentelemetry/auto-configuration-propagators');\n\nconst provider = new NodeTracerProvider();\nprovider.register({\n  propagator: getPropagator()\n});\n```\n\n1. The OpenTelemetry SDK is configured to export traces to a backend other than AWX X-Ray, but the lambda function is invoked by other AWS services which send the context using the X-Ray HTTP headers. In this case, include the `AWSXRayPropagator`, which extracts context from the HTTP header but not the Lambda Active Tracing context.\n\n```js\nconst { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');\nconst { AWSXRayLambdaPropagator } = require('@opentelemetry/propagator-aws-xray-lambda');\n\nconst provider = new NodeTracerProvider();\nprovider.register({\n  propagator: new AWSXRayPropagator()\n});\n```\n\nAlternatively, use the `auto-configuration-package` as in example #1 and set the OTEL_PROPAGATORS environment variable to `xray`.\n\nFor additional information, see the [documentation for lambda semantic conventions](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/faas/aws-lambda.md#aws-x-ray-active-tracing-considerations).\n\n### SQS Event Context Extraction\n\nWhen your Lambda function is triggered by SQS, the instrumentation creates a CONSUMER span with span links to the producer trace contexts extracted from the SQS messages.\n\nBy default, context is extracted from the `AWSTraceHeader` system attribute using the AWS X-Ray propagator, as defined by the [OpenTelemetry semantic conventions for AWS Lambda](https://opentelemetry.io/docs/specs/semconv/faas/aws-lambda/#sqs-event). This works when AWS X-Ray active tracing is enabled on the SQS queue.\n\nIf your SQS producers inject trace context into message attributes using the globally configured propagator (as `@opentelemetry/instrumentation-aws-sdk` does by default with W3C traceparent), set `useGlobalPropagatorForSqsExtraction: true`:\n\n```js\nnew AwsLambdaInstrumentation({\n    useGlobalPropagatorForSqsExtraction: true,\n})\n```\n\n## Semantic Conventions\n\nThis package uses `@opentelemetry/semantic-conventions` version `1.22+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md)\n\nAttributes collected on the invocation (SERVER) span:\n\n| Attribute          | Short Description                                                         |\n|--------------------|---------------------------------------------------------------------------|\n| `cloud.account.id` | The cloud account ID the resource is assigned to.                         |\n| `faas.execution`   | The execution ID of the current function execution.                       |\n| `faas.id`          | The unique ID of the single function that this runtime instance executes. |\n| `faas.coldstart`   | Whether the invocation is a cold start.                                   |\n| `faas.trigger`     | Type of the trigger (`pubsub` for SQS events).                           |\n\nAdditional attributes collected on the SQS process (CONSUMER) span:\n\n| Attribute                        | Short Description                                                  |\n|----------------------------------|--------------------------------------------------------------------|\n| `faas.trigger`                   | Type of the trigger (`pubsub`).                                    |\n| `messaging.operation.name`       | The name of the messaging operation (`process`).                   |\n| `messaging.operation.type`       | The type of the messaging operation (`process`).                   |\n| `messaging.system`               | The messaging system (`aws_sqs`).                                  |\n| `messaging.destination.name`     | The queue name extracted from the event source ARN.                |\n| `messaging.batch.message_count`  | The number of messages in the batch.                               |\n| `aws.sqs.queue.url`              | The reconstructed SQS queue URL.                                   |\n| `server.address`                 | The SQS regional domain name.                                      |\n\n## Useful links\n\n- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>\n- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>\n- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]\n\n## License\n\nApache 2.0 - See [LICENSE][license-url] for more information.\n\n[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions\n[license-url]: https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE\n[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat\n[npm-url]: https://www.npmjs.com/package/@opentelemetry/instrumentation-aws-lambda\n[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Finstrumentation-aws-lambda.svg\n","readmeFilename":"README.md"}