GoogleCloudPlatform/opentelemetry-operations-js

Error: 3 INVALID_ARGUMENT: The request contains an attribute key that is not valid (key=googclient_x-cloud-trace-context).

Opened this issue · 2 comments

What version of OpenTelemetry are you using?

1.9.0

What version of Node are you using?

18.7.0

What did you do?

I essentially followed this guide:
https://cloud.google.com/pubsub/docs/open-telemetry-tracing

Attempting to use the PubSub client with open telemetry by passing enableOpenTelemetry: true causes this error when calling publishMessage.

Error: 3 INVALID_ARGUMENT: The request contains an attribute key that is not valid (key=googclient_x-cloud-trace-context).

Example code deployed to Cloud Functions V2:

class OpenTelemetryPubSub extends PubSub {
    constructor(config: ClientConfig) {
        super({ ...config, enableOpenTelemetryTracing: true });
    }
}

const pubsub = new OpenTelemetryPubSub();

await pubsub.topic('my-topic').publishMessage({data: Buffer.from("...") })

I can get a repro set up if its not super obvious what is going wrong here.

What did you expect to see?

The message published with a trace header that propagates to the subscriber function

What did you see instead?

Error: 3 INVALID_ARGUMENT: The request contains an attribute key that is not valid (key=googclient_x-cloud-trace-context).

Error: 3 INVALID_ARGUMENT: The request contains an attribute key that is not valid (key=googclient_x-cloud-trace-context).

Are you using the GCP CloudPropagator from @google-cloud/opentelemetry-cloud-trace-propagator package in this repo by any chance? It should not be necessary and you can use the default W3C traceparent propagator instead.

I see, this is probably the issue. Might be useful to add this to the docs somewhere