OTEL context propagation with queues
Using Deno queues I want to make a span hierarchy like this.
I use the commands
await queue.enqueue(msg) and queue.listenQueue(async (msg) => ... and I've read https://docs.deno.com/runtime/fundamentals/open_telemetry/#context-propagation but haven't been able to get the listen-queue-span as a child of the parent-span.
Any help is greatly appreciated!Deno
OpenTelemetry
Learn how to implement observability in Deno applications using OpenTelemetry. Covers tracing, metrics collection, and integration with monitoring systems.
1 Reply
I don't see anything in the linked Deno OTEL docs about queues? So I wouldn't expect it to work automatically. Unless queues are mentioned there and I'm not seeing it - apologies if so!
Without proper support from Deno, you could do it DIY with manual context propagation. This would involve using
npm:@opentelemetry/api and adding calls to propagation.inject(...) before enqueueing, then propagation.extract(...) when receiving.
I've implemented this flow when writing messages via MongoDB collections. So that one trace passes thru the database layer. If it sounds worth it to you then hopefully these links can help:
* general docs https://opentelemetry.io/docs/languages/js/propagation/#manual-context-propagation
* necessary (for now) workaround https://github.com/denoland/deno/issues/28082#issuecomment-2653379957