-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Describe the question
I'm using the AWS Distro for OpenTelemetry (ADOT) Lambda layer with Node.js 22.x and the built-in Undici Fetch API (since Node.js 18+).
The instrumentation works correctly — spans are created and sent to AWS X-Ray — but all Undici spans appear with placeholder names and attributes such as:
"name": "UnknownRemoteService",
"aws.remote.service": "UnknownRemoteService",
"aws.remote.operation": "UnknownRemoteOperation"
I attempted to fix this by providing a custom Collector config via
OPENTELEMETRY_COLLECTOR_CONFIG_URI = s3://<bucket_name>/otel/collector_config.yaml
and adding a transform processor to rewrite the span name and attributes.
However, based on [issue #2300](aws-observability/aws-otel-collector#2300), it seems the ``** processor** may not be supported in the Lambda environment.
Steps to reproduce
-
Deploy a Node.js 22.x Lambda function using the
AWSOpenTelemetryDistroJslayer. -
Set environment variables:
AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-instrument OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true OTEL_METRICS_EXPORTER=none OTEL_NODE_ENABLED_INSTRUMENTATIONS=aws-sdk,aws-lambda,http,undici OPENTELEMETRY_COLLECTOR_CONFIG_URI=s3://<bucket_name>/otel/collector_config.yaml
-
In the function code, make a simple Fetch request:
await fetch("https://example.execute-api.eu-central-1.amazonaws.com/dev/test");
-
Observe the resulting trace in AWS X-Ray — the subsegment for the
fetch()call shows asUnknownRemoteService.
What did you expect to see?
Meaningful span names and attributes similar to AWS SDK instrumentations, for example:
"name": "example.execute-api.eu-central-1.amazonaws.com:443",
"aws.remote.service": "example.execute-api.eu-central-1.amazonaws.com:443",
"aws.remote.operation": "GET /dev/test"Environment
- Runtime: Node.js 22.x (AWS Lambda managed runtime)
- ADOT Layer:
AWSOpenTelemetryDistroJs(latest as of Oct 2025) - Collector Config: Loaded from S3 (
s3://<bucket_name>/otel/collector_config.yaml) - Region: eu-central-1
- Enabled Instrumentations:
aws-sdk,aws-lambda,http,undici
Collector Config (simplified)
receivers:
otlp:
protocols:
http: {}
grpc: {}
processors:
transform/fix-unknown:
error_mode: ignore
trace_statements:
- context: span
conditions:
- name == "UnknownRemoteService"
statements:
- set(name, Concat(attributes["server.address"], ":", attributes["server.port"]))
- set(attributes["aws.remote.service"], name)
- set(attributes["aws.remote.operation"], Concat(attributes["http.request.method"], " ", attributes["url.path"]))
exporters:
awsxray: {}
service:
pipelines:
traces:
receivers: [otlp]
processors: [transform/fix-unknown]
exporters: [awsxray]Additional context
- The same configuration works fine with the standalone ADOT Collector (e.g., on ECS or EKS).
- Within the Lambda ADOT layer, Undici spans remain labeled as
UnknownRemoteService. - AWS SDK spans are named properly (
sns.eu-central-1.amazonaws.com:443etc.), so only Undici appears affected. - If the
transformprocessor is not supported in the Lambda build, is there any recommended or supported way (e.g.spanorattributesprocessor) to modify span names for Undici/FETCH calls?
Would appreciate any guidance or confirmation about whether this is expected behavior, or if a configuration-based workaround exists.