Skip to content

Issue with @opentelemetry/instrumentation-aws-sdk when tracing sqs and tracestate is empty #1528

@bradleyquinn140

Description

@bradleyquinn140

What version of OpenTelemetry are you using?

As far as I can see I'm using the latest version(s)

"@opentelemetry/auto-instrumentations-node": "^0.37.0",
 "@opentelemetry/instrumentation": "^0.39.1",
 "@opentelemetry/sdk-node": "^0.39.1",

What version of Node are you using?

v16.20.0

What did you do?

  1. Have a trace where there is no tracestate (ie the internal representation is an empty map).
  2. Make a request to SQS with @opentelemetry/instrumentation-aws-sdk enabled.

What did you expect to see?

No error messages from the aws sdk

What did you see instead?

Message (user) attribute 'tracestate' must contain a non-empty value of type 'String'.
InvalidParameterValue: Message (user) attribute 'tracestate' must contain a non-empty value of type 'String'.
    at Request.extractError (/opt/app/node_modules/aws-sdk/lib/protocol/query.js:50:29)
    at Request.callListeners (/opt/app/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/opt/app/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/opt/app/node_modules/aws-sdk/lib/request.js:686:14)
    at Request.transition (/opt/app/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/opt/app/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /opt/app/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/opt/app/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/opt/app/node_modules/aws-sdk/lib/request.js:688:12)
    at Request.callListeners (/opt/app/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
    at Request.emit (/opt/app/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/opt/app/node_modules/aws-sdk/lib/request.js:686:14)
    at Request.transition (/opt/app/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/opt/app/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /opt/app/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/opt/app/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/opt/app/node_modules/aws-sdk/lib/request.js:688:12)
    at Request.callListeners (/opt/app/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
    at callNextListener (/opt/app/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
    at IncomingMessage.onEnd (/opt/app/node_modules/aws-sdk/lib/event_listeners.js:417:13)
    at /opt/app/node_modules/@opentelemetry/context-async-hooks/build/src/AbstractAsyncHooksContextManager.js:50:55
    at AsyncLocalStorage.run (node:async_hooks:319:14)

Additional context

I'm not sure if the issue is in this package or in the tracestate implementation (if I'm wrong sorry, I'll raise it in open-telemetry/opentelemetry-js)

It seems like sqs does not allow empty attributes ... from here

Important
All components of a message attribute are included in the 256 KB message size restriction.
The Name, Type, Value, and the message body must not be empty or null.

Which doesn't seem like it will work with the traceState implementation eg

createTraceState().serialize() // == ""

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpkg:instrumentation-aws-sdkpriority:p3Bugs which cause problems in user apps not related to correctness (performance, memory use, etc)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions