Skip to content

OpenTelemetry integration misses the point: we need to propagate the span/context! #1389

@hermanbanken

Description

@hermanbanken

The code where the Subscriber reads the span from the attributes just creates the span and then throws it away:

const span: Span | undefined = this._constructSpan(message);
if (this.isOpen) {
message.modAck(this.ackDeadline);
this._inventory.add(message);
} else {
message.nack();
}
if (span) {
span.end();
}

A good OpenTelemetry customer would then set the span to the current span in the on("message") handler, so that any subsequent processing is attached to the remote span.

I'll also file a Google support case.

Environment details

  • @google-cloud/pubsub version: master / v2.17.0

Steps to reproduce

  1. Enable OpenTelemetry in both publisher and subscriber using { enableOpenTelemetryTracing: true } options on topic and subscription.
  2. Perform some processing that creates spans, either manually or (for example) do a Datastore Query or Put.

It can be observed that actions are linked to the subscriber span, as can also be seen in this screenshot (spans take <1ms because nothing is done inside):
Screenshot 2021-08-30 at 16 47 23

Relates to #1078.

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the googleapis/nodejs-pubsub API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions