Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.sentry.systemtest

import io.sentry.systemtest.util.TestHelper
import kotlin.test.Test
import kotlin.test.assertEquals
import org.junit.Before

/**
* System tests for Kafka queue instrumentation on the OTel Jakarta noagent sample.
*
* The Sentry Kafka auto-configuration (`SentryKafkaQueueConfiguration`) is intentionally suppressed
* when `io.sentry.opentelemetry.SentryAutoConfigurationCustomizerProvider` is on the classpath, so
* the Sentry `SentryKafkaProducerInterceptor` and `SentryKafkaRecordInterceptor` must not be wired.
*
* These tests produce a Kafka message end-to-end and assert that Sentry-style `queue.publish` /
* `queue.process` spans/transactions are *not* emitted. Any Kafka telemetry in OTel mode must come
* from the OTel Kafka instrumentation, not from the Sentry Kafka integration.
*
* Requires:
* - The sample app running with `--spring.profiles.active=kafka`
* - A Kafka broker at localhost:9092
* - The mock Sentry server at localhost:8000
*/
class KafkaOtelCoexistenceSystemTest {
lateinit var testHelper: TestHelper

@Before
fun setup() {
testHelper = TestHelper("http://localhost:8080")
testHelper.reset()
}

@Test
fun `Sentry Kafka integration is suppressed when OTel is active`() {
val restClient = testHelper.restClient

restClient.produceKafkaMessage("otel-coexistence-test")
assertEquals(200, restClient.lastKnownStatusCode)

testHelper.ensureNoTransactionReceived { transaction, _ ->
transaction.contexts.trace?.operation == "queue.process" ||
transaction.spans.any { span -> span.op == "queue.publish" }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.sentry.systemtest

import io.sentry.systemtest.util.TestHelper
import kotlin.test.Test
import kotlin.test.assertEquals
import org.junit.Before

/**
* System tests for Kafka queue instrumentation on the OTel Jakarta sample.
*
* The Sentry Kafka auto-configuration (`SentryKafkaQueueConfiguration`) is intentionally suppressed
* when `io.sentry.opentelemetry.SentryAutoConfigurationCustomizerProvider` is on the classpath, so
* the Sentry `SentryKafkaProducerInterceptor` and `SentryKafkaRecordInterceptor` must not be wired.
*
* These tests produce a Kafka message end-to-end and assert that Sentry-style `queue.publish` /
* `queue.process` spans/transactions are *not* emitted. Any Kafka telemetry in OTel mode must come
* from the OTel Kafka instrumentation, not from the Sentry Kafka integration.
*
* Requires:
* - The sample app running with `--spring.profiles.active=kafka`
* - A Kafka broker at localhost:9092
* - The mock Sentry server at localhost:8000
*/
class KafkaOtelCoexistenceSystemTest {
lateinit var testHelper: TestHelper

@Before
fun setup() {
testHelper = TestHelper("http://localhost:8080")
testHelper.reset()
}

@Test
fun `Sentry Kafka integration is suppressed when OTel is active`() {
val restClient = testHelper.restClient

restClient.produceKafkaMessage("otel-coexistence-test")
assertEquals(200, restClient.lastKnownStatusCode)

testHelper.ensureNoTransactionReceived { transaction, _ ->
transaction.contexts.trace?.operation == "queue.process" ||
transaction.spans.any { span -> span.op == "queue.publish" }
}
}
}
4 changes: 4 additions & 0 deletions test/system-test-runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,13 @@
KAFKA_BROKER_REQUIRED_MODULES = {
"sentry-samples-console",
"sentry-samples-spring-boot-jakarta",
"sentry-samples-spring-boot-jakarta-opentelemetry",
"sentry-samples-spring-boot-jakarta-opentelemetry-noagent",
}
KAFKA_PROFILE_REQUIRED_MODULES = {
"sentry-samples-spring-boot-jakarta",
"sentry-samples-spring-boot-jakarta-opentelemetry",
"sentry-samples-spring-boot-jakarta-opentelemetry-noagent",
}

class ServerType(Enum):
Expand Down
Loading