APM Spring JMS Template

When I follow the standard way of Spring to use JMSTeplate, the the APM agent trace the JMS trace as shown below.

Are there some limitations of usage from Spring-JmsTemplate ?

Hi and thanks for your question. What would you like to see instead?

The name of the destination :smiley:.

Right, this is one of the things we are going to add next.

First, we want to properly add them to our schema, which is WIP. The current plan is to add the destination name (not address) as context.message.queue.name and context.message.topic.name. Is that what you are looking for?

A few quick questions:

  • Why isn't distributed tracing working in this case? Do you have an agent on the sender as well?
  • What does your app do when receiving a message like in this screenshot? Does it do additional actions you would expect to see spans for (eg DB query, remote HTTP request, manually created custom spans)?

Thanks,
Eyal.

H Eyal,

so I evaluate the problem.

There are Serval things:

  1. If I use the jms from my app code then everything works excpected
  2. If I send messages over the admin cosnsole from artemis jms broker then the spans doent covered. But I can life with that behviour.
  3. I have two Spring application. In the first app jms used over JMS 2.0 api. The second spring app uses jms over Spring JmsTemplate. And this one have always the span wit "JMS RECEIVE" without a desination name.

Ahh right, it's missing in the span name...
If you don't see any agent-related errors or warnings, I would guess this is related to the receive method returning without a valid message.

Please try to make sure you are looking at a receive method that returned a message object, or look for interesting things in logs.

2019-10-02 13:15:09.305 [DefaultMessageListenerContainer-1] DEBUG co.elastic.apm.agent.bci.ElasticApmAgent - Type match for instrumentation ReceiveInstrumentation: (not(isInterface()) and hasSuperType(erasure(name(equals(javax.jms.MessageConsumer))))) matches class org.apache.activemq.artemis.jms.client.ActiveMQMessageConsumer
2019-10-02 13:15:09.305 [DefaultMessageListenerContainer-1] DEBUG co.elastic.apm.agent.bci.ElasticApmAgent - Type match for instrumentation SetMessageListenerInstrumentation: (not(isInterface()) and hasSuperType(erasure(name(equals(javax.jms.MessageConsumer))))) matches class org.apache.activemq.artemis.jms.client.ActiveMQMessageConsumer
2019-10-02 13:15:09.315 [DefaultMessageListenerContainer-1] DEBUG co.elastic.apm.agent.bci.ElasticApmAgent - Method match for instrumentation SetMessageListenerInstrumentation: (name(equals(setMessageListener)) and hasParameter(hasTypes(with(0 matches erasure(name(equals(javax.jms.MessageListener))))))) matches public void org.apache.activemq.artemis.jms.client.ActiveMQMessageConsumer.setMessageListener(javax.jms.MessageListener) throws javax.jms.JMSException
2019-10-02 13:15:09.315 [DefaultMessageListenerContainer-1] DEBUG co.elastic.apm.agent.bci.ElasticApmAgent - Method match for instrumentation ReceiveInstrumentation: (((name(equals(receive)) and (hasParameter(ofSize(0)) or hasParameter(ofSize(1)))) and isPublic()) or (name(equals(receiveNoWait)) and (hasParameter(ofSize(0)) and isPublic()))) matches public javax.jms.Message org.apache.activemq.artemis.jms.client.ActiveMQMessageConsumer.receive() throws javax.jms.JMSException
2019-10-02 13:15:09.316 [DefaultMessageListenerContainer-1] DEBUG co.elastic.apm.agent.bci.ElasticApmAgent - Method match for instrumentation ReceiveInstrumentation: (((name(equals(receive)) and (hasParameter(ofSize(0)) or hasParameter(ofSize(1)))) and isPublic()) or (name(equals(receiveNoWait)) and (hasParameter(ofSize(0)) and isPublic()))) matches public javax.jms.Message org.apache.activemq.artemis.jms.client.ActiveMQMessageConsumer.receive(long) throws javax.jms.JMSException
2019-10-02 13:15:09.316 [DefaultMessageListenerContainer-1] DEBUG co.elastic.apm.agent.bci.ElasticApmAgent - Method match for instrumentation ReceiveInstrumentation: (((name(equals(receive)) and (hasParameter(ofSize(0)) or hasParameter(ofSize(1)))) and isPublic()) or (name(equals(receiveNoWait)) and (hasParameter(ofSize(0)) and isPublic()))) matches public javax.jms.Message org.apache.activemq.artemis.jms.client.ActiveMQMessageConsumer.receiveNoWait() throws javax.jms.JMSException
2019-10-02 13:15:09.318 [DefaultMessageListenerContainer-1] DEBUG co.elastic.apm.agent.impl.transaction.AbstractSpan - increment references to '' 00-c81d42c68a873922b1f41a76dc0dbb56-753e620da4583a8b-01 (36f4b255) (1)
2019-10-02 13:15:09.318 [DefaultMessageListenerContainer-1] DEBUG co.elastic.apm.agent.impl.ElasticApmTracer - startTransaction '' 00-c81d42c68a873922b1f41a76dc0dbb56-753e620da4583a8b-01 (36f4b255) {
2019-10-02 13:15:09.318 [DefaultMessageListenerContainer-1] DEBUG co.elastic.apm.agent.impl.transaction.AbstractSpan - increment references to 'JMS RECEIVE' 00-c81d42c68a873922b1f41a76dc0dbb56-753e620da4583a8b-01 (36f4b255) (2)
2019-10-02 13:15:09.318 [DefaultMessageListenerContainer-1] DEBUG co.elastic.apm.agent.impl.ElasticApmTracer - Activating 'JMS RECEIVE' 00-c81d42c68a873922b1f41a76dc0dbb56-753e620da4583a8b-01 (36f4b255) on thread 120

All JMS receive transactions start with the name JMS RECEIVE. The destination is appended to the name if the receive method is returning a (non-null) Message.

In upcoming releases this will be changed, so that JMS receive actions retuning null will be discarded.

1 Like

Thanks for clarification