From 118d244d21c8f7a58396da5f7ce0d6da244a9186 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 21 Apr 2026 12:19:35 +0200 Subject: [PATCH] ref(samples): [Queue Instrumentation 19] Drop Kafka auto-config exclude from Spring Boot samples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove `spring.autoconfigure.exclude=KafkaAutoConfiguration` from the default `application.properties` and the matching empty override from `application-kafka.properties` in the three Spring Boot Jakarta samples. `spring.autoconfigure.exclude` is a single list property, so overriding it in a profile replaces the whole list rather than merging. Adding a sibling `rabbitmq` profile with the same pattern would not compose — activating one profile would unsilence the other's auto-config. The `@Profile("kafka")` annotations already on `KafkaConsumer` and `KafkaController` gate the actual listener container and endpoint, so no broker connection is attempted when the profile is inactive. `KafkaAutoConfiguration` still runs and creates an unused `KafkaTemplate` bean in that case, which is harmless. Sentry's own Kafka auto-config remains gated on `sentry.enable-queue-tracing=true`, which is only set in `application-kafka.properties`, so Sentry instrumentation behavior is unchanged. --- .../src/main/resources/application-kafka.properties | 1 - .../src/main/resources/application.properties | 3 --- .../src/main/resources/application-kafka.properties | 1 - .../src/main/resources/application.properties | 3 --- .../src/main/resources/application-kafka.properties | 1 - .../src/main/resources/application.properties | 3 --- 6 files changed, 12 deletions(-) diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application-kafka.properties b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application-kafka.properties index fe79e3faca..e0abadf5f9 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application-kafka.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application-kafka.properties @@ -1,7 +1,6 @@ # Kafka — activate with: --spring.profiles.active=kafka sentry.enable-queue-tracing=true -spring.autoconfigure.exclude= spring.kafka.bootstrap-servers=localhost:9092 spring.kafka.consumer.group-id=sentry-sample-group spring.kafka.consumer.auto-offset-reset=earliest diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application.properties index ff8897ad68..a3a59d290b 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application.properties @@ -35,9 +35,6 @@ spring.graphql.graphiql.enabled=true spring.graphql.websocket.path=/graphql spring.quartz.job-store-type=memory -# Kafka is only active with the 'kafka' profile (--spring.profiles.active=kafka) -spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration - # Cache tracing sentry.enable-cache-tracing=true spring.cache.cache-names=todos diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application-kafka.properties b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application-kafka.properties index fe79e3faca..e0abadf5f9 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application-kafka.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application-kafka.properties @@ -1,7 +1,6 @@ # Kafka — activate with: --spring.profiles.active=kafka sentry.enable-queue-tracing=true -spring.autoconfigure.exclude= spring.kafka.bootstrap-servers=localhost:9092 spring.kafka.consumer.group-id=sentry-sample-group spring.kafka.consumer.auto-offset-reset=earliest diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application.properties index d19e874624..12a9ca1726 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application.properties @@ -35,9 +35,6 @@ spring.graphql.graphiql.enabled=true spring.graphql.websocket.path=/graphql spring.quartz.job-store-type=memory -# Kafka is only active with the 'kafka' profile (--spring.profiles.active=kafka) -spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration - # Cache tracing sentry.enable-cache-tracing=true spring.cache.cache-names=todos diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application-kafka.properties b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application-kafka.properties index 71e517b82a..eaaa62af13 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application-kafka.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application-kafka.properties @@ -1,7 +1,6 @@ # Kafka — activate with: --spring.profiles.active=kafka sentry.enable-queue-tracing=true -spring.autoconfigure.exclude= spring.kafka.bootstrap-servers=localhost:9092 spring.kafka.consumer.group-id=sentry-sample-group spring.kafka.consumer.auto-offset-reset=earliest diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties index 6a3dfb063b..20f9463aab 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties @@ -38,9 +38,6 @@ spring.quartz.job-store-type=memory # Cache tracing sentry.enable-cache-tracing=true -# Kafka is only active with the 'kafka' profile (--spring.profiles.active=kafka) -spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration - spring.cache.cache-names=todos spring.cache.caffeine.spec=maximumSize=500,expireAfterAccess=600s