Skip to content

Commit b21192b

Browse files
committed
Merge branch 'feat/queue-instrumentation-otel-messaging-mapping' into feat/kafka-producer-wrapper
2 parents 5e0629d + 3eeacb5 commit b21192b

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

sentry-opentelemetry/sentry-opentelemetry-core/src/test/kotlin/SpanDescriptionExtractorTest.kt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,23 @@ class SpanDescriptionExtractorTest {
265265
assertEquals(TransactionNameSource.TASK, info.transactionNameSource)
266266
}
267267

268+
@Test
269+
fun `maps messaging send operation type to queue publish op`() {
270+
givenAttributes(
271+
mapOf(
272+
MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka",
273+
MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic",
274+
MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "send",
275+
)
276+
)
277+
278+
val info = whenExtractingSpanInfo(queueTracingEnabled = true)
279+
280+
assertEquals("queue.publish", info.op)
281+
assertEquals("my-topic", info.description)
282+
assertEquals(TransactionNameSource.TASK, info.transactionNameSource)
283+
}
284+
268285
@Test
269286
fun `maps messaging process operation type to queue process op`() {
270287
givenAttributes(
@@ -282,6 +299,23 @@ class SpanDescriptionExtractorTest {
282299
assertEquals(TransactionNameSource.TASK, info.transactionNameSource)
283300
}
284301

302+
@Test
303+
fun `maps messaging deliver operation type to queue process op`() {
304+
givenAttributes(
305+
mapOf(
306+
MessagingIncubatingAttributes.MESSAGING_SYSTEM to "kafka",
307+
MessagingIncubatingAttributes.MESSAGING_DESTINATION_NAME to "my-topic",
308+
MessagingIncubatingAttributes.MESSAGING_OPERATION_TYPE to "deliver",
309+
)
310+
)
311+
312+
val info = whenExtractingSpanInfo(queueTracingEnabled = true)
313+
314+
assertEquals("queue.process", info.op)
315+
assertEquals("my-topic", info.description)
316+
assertEquals(TransactionNameSource.TASK, info.transactionNameSource)
317+
}
318+
285319
@Test
286320
fun `maps messaging create operation type to queue create op`() {
287321
givenAttributes(

0 commit comments

Comments
 (0)