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
FieldsModifier and TypeFieldDescriptionstatic final StringThe replacement of dashes in the names of message properties.static final StringThe property that disables tracing.static final StringThe 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 TypeMethodDescriptionprocess(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, waitMethods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Field Details
-
ENABLED
-
INSTRUMENTATION_SCOPE
The name of the instrumentation scope of the spans.- See Also:
-
DASH
The replacement of dashes in the names of message properties.- See Also:
-
-
Method Details
-
process
public JMSObservation process(JMSDestinationType destinationType, String destination, jakarta.jms.Message message) Description copied from interface:JMSMessageObserverCalled before a listener processes a message: before the listener method and the success and error handlers.- Specified by:
processin interfaceJMSMessageObserver- Parameters:
destinationType- The type of the destinationdestination- The name of the destination the listener consumes frommessage- The message- Returns:
- The observation to complete once the message is processed, or
null
-
send
Description copied from interface:JMSMessageObserverCalled 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'sJMSObservation.beforeSend(Message)is called with it, so properties added to the message are sent with it.- Specified by:
sendin interfaceJMSMessageObserver- Parameters:
destinationType- The type of the destinationdestination- 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
-