-
Notifications
You must be signed in to change notification settings - Fork 233
Open
Labels
api: pubsubIssues related to the googleapis/nodejs-pubsub API.Issues related to the googleapis/nodejs-pubsub API.
Description
A step-by-step description of how to reproduce the issue, based on the linked reproduction.
- Enable OpenTelemetry by setting
enableOpenTelemetryTracing: truein thePubSubconstructor - Try to send more than one message at the same time
- See messages like
Cannot execute the operation on ended Span {traceId: e60f51b12990ebe1359223f4db06b98e, spanId: 01c61e673f5ed52e}andsend e60f51b12990ebe1359223f4db06b98e-01c61e673f5ed52e - You can only call end() on a span once.in the console
A clear and concise description of what the bug is, and what you expected to happen.
The OpenTelemetry span could be ended only once. But MessageQueue._publish method could close rpcSpan and message parent spans more than once if it has more than one message to process, because closing spans is implemented in the loop:
nodejs-pubsub/src/publisher/message-queues.ts
Lines 175 to 180 in 91ebe73
| messages.forEach(m => { | |
| // We're finished with both the RPC and the whole publish operation, | |
| // so close out all of the related spans. | |
| rpcSpan?.end(); | |
| tracing.PubsubEvents.publishEnd(m); | |
| m.parentSpan?.end(); |
A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **
There are no docs describing OpenTelemetry span.end behaviour. However, you could see that it is forbidden in the Otel source code:
https://github.com/open-telemetry/opentelemetry-js/blob/5333204134f71f42c4612735106f83fa8c691102/packages/opentelemetry-sdk-trace-base/src/Span.ts#L267-L272
Metadata
Metadata
Assignees
Labels
api: pubsubIssues related to the googleapis/nodejs-pubsub API.Issues related to the googleapis/nodejs-pubsub API.