Skip to content

ADOT lambda layer does not set AWS X-Ray-specific annotations for undici #1129

@DCzajkowski

Description

@DCzajkowski

name: Bug report
about: Create a report to help us improve
title: 'ADOT lambda layer does not set AWS X-Ray-specific annotations for undici'
labels: bug
assignees: ''


Describe the bug

Making requests using Node.js's fetch sets AWS X-Ray-specific annotations as:

  • aws.remote.service = UnknownRemoteService
  • aws.remote.operation = UnknownRemoteOperation

Making requests using nodejs:https module correctly sets aws.remote.service and aws.remote.operation.

Steps to reproduce

  1. Create a Node.js lambda function that uses ADOT lambda layer.
  2. Set environment variable OTEL_NODE_ENABLED_INSTRUMENTATIONS=aws-sdk,aws-lambda,http,undici.
  3. You can use this code for your lambda implementation:
index.mjs
export async function handler() {
  const traceIdEnv = process.env._X_AMZN_TRACE_ID
  const traceId = traceIdEnv.split(';')[0].split('=')[1]

  const response = await fetch('https://jsonplaceholder.typicode.com/todos/2')
  const data = await response.json()

  console.log('Status API response:', data)

  return {
    statusCode: 200,
    body: JSON.stringify({ traceId }),
  }
}
  1. Go to the X-Ray trace.

What did you expect to see?
I expect aws.remote.service and aws.remote.operation to be set correctly.

What did you see instead?
aws.remote.service and aws.remote.operation are set to UnknownRemoteService and UnknownRemoteOperation respectively.

X-Ray console screenshot Image

What version of collector/language SDK version did you use?
No SDK, just the lambda layer

What language layer did you use?
Config: Node.js 22.x, layer arn:aws:lambda:us-east-1:615299751070:layer:AWSOpenTelemetryDistroJs:10

Additional context
empty

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions