Class JMSTracing

java.lang.Object
io.micronaut.jms.tracing.opentelemetry.JMSTracing
All Implemented Interfaces:
io.micronaut.core.order.Ordered, JMSMessageObserver

@Singleton @Requires(beans=io.opentelemetry.api.OpenTelemetry.class) @Requires(property="micronaut.jms.tracing.enabled",notEquals="false") public final class JMSTracing extends Object implements JMSMessageObserver
Traces the messages that JMS listeners process and that JMS producers send with the OpenTelemetry bean of Micronaut Tracing. A producer span (send <destination>) starts before the connection is taken and propagates its context in message properties. A consumer span (process <destination>) continues it and is the current span while the listener method runs, also in the PropagatedContext, so it follows the thread hops of Micronaut's context propagation. Property names that are not Java identifiers, such as those of B3 headers, have their dashes replaced with "__dash__", as the OpenTelemetry Java agent does. Disable it with micronaut.jms.tracing.enabled: false.
Since:
5.2.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The replacement of dashes in the names of message properties.
    static final String
    The property that disables tracing.
    static final String
    The name of the instrumentation scope of the spans.

    Fields inherited from interface io.micronaut.core.order.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Method Summary

    Modifier and Type
    Method
    Description
    process(JMSDestinationType destinationType, String destination, jakarta.jms.Message message)
    Called before a listener processes a message: before the listener method and the success and error handlers.
    send(JMSDestinationType destinationType, String destination)
    Called before a producer sends a message, before the connection is taken from the pool and the message is created, so a send that fails to connect is observed too.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.core.order.Ordered

    getOrder
  • Field Details

  • Method Details

    • process

      public JMSObservation process(JMSDestinationType destinationType, String destination, jakarta.jms.Message message)
      Description copied from interface: JMSMessageObserver
      Called before a listener processes a message: before the listener method and the success and error handlers.
      Specified by:
      process in interface JMSMessageObserver
      Parameters:
      destinationType - The type of the destination
      destination - The name of the destination the listener consumes from
      message - The message
      Returns:
      The observation to complete once the message is processed, or null
    • send

      public JMSObservation send(JMSDestinationType destinationType, String destination)
      Description copied from interface: JMSMessageObserver
      Called before a producer sends a message, before the connection is taken from the pool and the message is created, so a send that fails to connect is observed too. Once the message is created and its headers are set, the observation's JMSObservation.beforeSend(Message) is called with it, so properties added to the message are sent with it.
      Specified by:
      send in interface JMSMessageObserver
      Parameters:
      destinationType - The type of the destination
      destination - The name of the destination the message is sent to
      Returns:
      The observation to complete once the message is sent or the send failed, or null