Class TracingUtils


  • public abstract class TracingUtils
    extends Object
    Utility methods to manage spans for incoming and outgoing messages.
    • Method Detail

      • initialise

        public static void initialise()
      • getTracingMetaData

        public static TracingMetadata getTracingMetaData​(io.vertx.rabbitmq.RabbitMQMessage msg)
        Extract tracing metadata from a received RabbitMQ message and return it as TracingMetadata.
        Parameters:
        msg - the incoming RabbitMQ message
        Returns:
        a TracingMetadata instance, possibly empty but never null
      • addIncomingTrace

        public static <T> Message<T> addIncomingTrace​(IncomingRabbitMQMessage<T> msg,
                                                      String queue,
                                                      List<String> attributeHeaders)
        Creates a span based on any tracing metadata in the incoming message.
        Type Parameters:
        T - the message body type
        Parameters:
        msg - the incoming message
        attributeHeaders - a list (possibly empty) of header names whose values (if present) should be used as span attributes
        Returns:
        the message, with injected tracing metadata
      • createOutgoingTrace

        public static void createOutgoingTrace​(Message<?> message,
                                               Map<String,​Object> headers,
                                               String exchange,
                                               String routingKey,
                                               List<String> attributeHeaders)
        Creates a new outgoing message span message, and ensures span metadata is added to the message headers.
        Parameters:
        message - the source message
        headers - the outgoing headers, must be mutable
        exchange - the target exchange
        routingKey - the routing key
        attributeHeaders - a list (possibly empty) of header names whose values (if present) should be used as span attributes