OpenTracing Instrumentation for Spring JMS API


Лицензия

Лицензия

Группа

Группа

io.opentracing.contrib
Идентификатор

Идентификатор

opentracing-jms-spring
Последняя версия

Последняя версия

0.1.11
Дата

Дата

Тип

Тип

jar
Описание

Описание

OpenTracing Instrumentation for Spring JMS API
OpenTracing Instrumentation for Spring JMS API

Скачать opentracing-jms-spring

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-jms-spring/ -->
<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-jms-spring</artifactId>
    <version>0.1.11</version>
</dependency>
// https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-jms-spring/
implementation 'io.opentracing.contrib:opentracing-jms-spring:0.1.11'
// https://jarcasting.com/artifacts/io.opentracing.contrib/opentracing-jms-spring/
implementation ("io.opentracing.contrib:opentracing-jms-spring:0.1.11")
'io.opentracing.contrib:opentracing-jms-spring:jar:0.1.11'
<dependency org="io.opentracing.contrib" name="opentracing-jms-spring" rev="0.1.11">
  <artifact name="opentracing-jms-spring" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.opentracing.contrib', module='opentracing-jms-spring', version='0.1.11')
)
libraryDependencies += "io.opentracing.contrib" % "opentracing-jms-spring" % "0.1.11"
[io.opentracing.contrib/opentracing-jms-spring "0.1.11"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
io.opentracing.contrib : opentracing-jms-2 jar 0.1.11

provided (3)

Идентификатор библиотеки Тип Версия
javax.jms : javax.jms-api jar 2.0.1
org.springframework : spring-jms jar 5.1.9.RELEASE
org.springframework : spring-context jar 5.1.9.RELEASE

test (7)

Идентификатор библиотеки Тип Версия
org.springframework : spring-test jar 5.1.9.RELEASE
org.apache.activemq : activemq-broker jar 5.15.11
org.apache.activemq : activemq-kahadb-store jar 5.15.11
org.mockito : mockito-core jar 2.28.2
org.awaitility : awaitility jar 3.1.6
junit : junit jar 4.12
io.opentracing : opentracing-mock jar 0.33.0

Модули Проекта

Данный проект не имеет модулей.

Build Status Coverage Status Released Version Apache-2.0 license

OpenTracing JMS Instrumentation

OpenTracing instrumentation for JMS.

Installation

JMS 1

pom.xml

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-jms-1</artifactId>
    <version>VERSION</version>
</dependency>

JMS 2

pom.xml

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-jms-2</artifactId>
    <version>VERSION</version>
</dependency>

Spring JMS

pom.xml

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-jms-spring</artifactId>
    <version>VERSION</version>
</dependency>

You most likely need to exclude spring-jms and spring-context dependencies and add own (to avoid jar hell):

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-jms-spring</artifactId>
    <version>VERSION</version>
    <exclusions>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
        </exclusion>
        <exclusion>
             <groupId>org.springframework</groupId>
             <artifactId>spring-context</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jms</artifactId>
    <version>required version</version>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>required version</version>
</dependency>

Usage

// Instantiate tracer
Tracer tracer = ...

JMS API

// decorate JMS MessageProducer with TracingMessageProducer
TracingMessageProducer producer = new TracingMessageProducer(messageProducer, tracer);

// decorate JMS JMSProducer with TracingJMSProducer need Session
Session session = ...
TracingJMSProducer producer = new TracingJMSProducer(jmsProducer, session, tracer);
// or with JMSContext
JMSContext jmsContext = ...
TracingJMSProducer producer = new TracingJMSProducer(jmsProducer, jmsContext, tracer);

// decorate JMS MessageConsumer with TracingMessageConsumer
TracingMessageConsumer consumer = new TracingMessageConsumer(messageConsumer, tracer);

// decorate JMS MessageListener if used with TracingMessageListener
TracingMessageListener listener = new TracingMessageListener(messageListener, tracer);
consumer.setMessageListener(listener);

// send message
Message message = ...
producer.send(message);

// receive message
Message message = consumer.receive();

Spring JMS

// create TracingJmsTemplate which extends Spring JmsTemplate
JmsTemplate jmsTemplate = new TracingJmsTemplate(connectionFactory, tracer); 

// send and receive messages as usual
jmsTemplate.send(...)
jmsTemplate.convertAndSend(...);
jmsTemplate.receive(...)
jmsTemplate.receiveAndConvert(...);
...

If @JmsListener is used then it is required to import TracingJmsConfiguration e.g.

@Configuration 
@Import(TracingJmsConfiguration.class)
@EnableJms
public class JmsConfiguration {
 ...
}

Java 9+

Modules opentracing-jms-1 and opentracing-jms-2 have next Automatic-Module-Name accordingly:

  • io.opentracing.contrib.jms1
  • io.opentracing.contrib.jms2

OpenTracing Conventions

Message properties

When a message exchange between a producer and consumer is traced using an OpenTracing compliant tracer, the trace context and any defined baggage items will be carried in the JMS message properties.

OpenTracing does not place any restrictions on the names used for the trace context and baggage item properties. However the JMS API does not permit the hyphen/dash - character to be used. Therefore, it is necessary to encode the trace context and baggage item names.

The steps used to encode the key names are:

  • replace any - character with __dash__

When the message is consumed, the steps are reversed to decode the original key names.

Any libraries that instrument the JMS API should conform to this convention to enable tracing interoperability.

License

Apache 2.0 License.

io.opentracing.contrib

3rd-Party OpenTracing API Contributions

3rd-party contributions that use OpenTracing. **The repositories in this org are *not* affiliated with the CNCF.**

Версии библиотеки

Версия
0.1.11
0.1.10
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1