-
Notifications
You must be signed in to change notification settings - Fork 845
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support suppress-messaging-receive-span in JMS (#4204)
* Support suppress-messaging-receive-span in JMS * Spotless
- Loading branch information
Showing
4 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...src/jms2TestReceiveSpansDisabled/groovy/SpringListenerJms2SuppressReceiveSpansTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification | ||
import listener.Config | ||
import org.springframework.context.annotation.AnnotationConfigApplicationContext | ||
import org.springframework.jms.core.JmsTemplate | ||
|
||
import javax.jms.ConnectionFactory | ||
|
||
class SpringListenerJms2SuppressReceiveSpansTest extends AgentInstrumentationSpecification { | ||
def "receiving message in spring listener generates spans"() { | ||
setup: | ||
def context = new AnnotationConfigApplicationContext(Config) | ||
def factory = context.getBean(ConnectionFactory) | ||
def template = new JmsTemplate(factory) | ||
|
||
template.convertAndSend("SpringListenerJms2", "a message") | ||
|
||
expect: | ||
assertTraces(1) { | ||
trace(0, 2) { | ||
Jms2Test.producerSpan(it, 0, "queue", "SpringListenerJms2") | ||
Jms2Test.consumerSpan(it, 1, "queue", "SpringListenerJms2", "", span(0), "process") | ||
} | ||
} | ||
|
||
cleanup: | ||
context.close() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...ation/jms-1.1/javaagent/src/test/groovy/SpringListenerJms1SuppressReceiveSpansTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification | ||
import listener.Config | ||
import org.springframework.context.annotation.AnnotationConfigApplicationContext | ||
import org.springframework.jms.core.JmsTemplate | ||
|
||
import javax.jms.ConnectionFactory | ||
|
||
import static Jms1Test.consumerSpan | ||
import static Jms1Test.producerSpan | ||
|
||
class SpringListenerJms1SuppressReceiveSpansTest extends AgentInstrumentationSpecification { | ||
|
||
def "receiving message in spring listener generates spans"() { | ||
setup: | ||
def context = new AnnotationConfigApplicationContext(Config) | ||
def factory = context.getBean(ConnectionFactory) | ||
def template = new JmsTemplate(factory) | ||
|
||
template.convertAndSend("SpringListenerJms1", "a message") | ||
|
||
expect: | ||
assertTraces(1) { | ||
trace(0, 2) { | ||
producerSpan(it, 0, "queue", "SpringListenerJms1") | ||
consumerSpan(it, 1, "queue", "SpringListenerJms1", "", span(0), "process") | ||
} | ||
} | ||
|
||
cleanup: | ||
context.stop() | ||
} | ||
} |