How to propagate context between two services communicating via rabbitmq in opentelemetry?

1k Views Asked by At

I am trying to find a way to propagate context between two services communicating via rabbitmq in opentelemetry. There was an article for doing similar in Go article link but unable to implement it in node.

There are two approaches I am considering

  1. Pass context in header of message published via broker. Or
  2. Create a child span based on the traceId and spanId. answer link there's an answer for this in Go, but couldn't find a way to create a new span.

Is there any code reference available to perform any of the above?

1

There are 1 best solutions below

0
On

Opentelemetry Node already has plugin for the amqp lib which already does the work for you i.e inject/extract context https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/instrumentation-amqplib.