-
Notifications
You must be signed in to change notification settings - Fork 233
Description
Please make sure you have searched for information in the following guides.
- Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
- Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
- Check our Troubleshooting guide: https://github.com/googleapis/google-cloud-node/blob/main/docs/troubleshooting.md
- Check our FAQ: https://github.com/googleapis/google-cloud-node/blob/main/docs/faq.md
- Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md
- Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs
- Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples
A screenshot that you have tested with "Try this API".
The google-cloud/pubsub library creates a new otel span: rpcSpan encapsulating multiple messages being published. However in the finally block it calls rpcSpan?.end() within a loop that is handling each individual message span, causing span end errors when there are more than one message present. src/publisher/message-queues.ts
Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.
nodejs-pubsub/src/publisher/message-queues.ts
Line 178 in d8cd0e7
| rpcSpan?.end(); |
A step-by-step description of how to reproduce the issue, based on the linked reproduction.
Can not execute the operation on ended Span {traceId: 48c28ff6f9fee16da62f142e62fe847a, spanId: b4256fc107bc37ce}
topic_name send 48c28ff6f9fee16da62f142e62fe847a-b4256fc107bc37ce - You can only call end() on a span once.
A clear and concise description of what the bug is, and what you expected to happen.
The google-cloud/pubsub library creates a new otel span: rpcSpan encapsulating multiple messages being published. However in the finally block it calls rpcSpan?.end() within a loop that is handling each individual message span, causing span end errors when there are more than one message present.
nodejs-pubsub/src/publisher/message-queues.ts
Line 178 in d8cd0e7
| rpcSpan?.end(); |
rpcSpan?.end() should live outside of the forEach loop
rpcSpan?.end();
messages.forEach(m => {
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. **
"You can only call end() on a span once." errors should not happen