Skip to content

fix(spring-boot-jakarta): [Queue Instrumentation 37] Skip Kafka autoconfig for OTel agent#5343

Draft
adinauer wants to merge 1 commit intofix/kafka-consumer-interceptor-reflectionfrom
fix/kafka-otel-agent-autoconfig
Draft

fix(spring-boot-jakarta): [Queue Instrumentation 37] Skip Kafka autoconfig for OTel agent#5343
adinauer wants to merge 1 commit intofix/kafka-consumer-interceptor-reflectionfrom
fix/kafka-otel-agent-autoconfig

Conversation

@adinauer
Copy link
Copy Markdown
Member

@adinauer adinauer commented Apr 29, 2026

PR Stack (Queue Instrumentation)


📜 Description

Prevent Spring Kafka auto-configuration from installing Sentry Kafka bean post-processors when the Sentry OpenTelemetry Java agent is active.

This change also updates the Jakarta OTel coexistence system tests to assert the intended behavior: OTel queue spans still reach Sentry, but the Sentry SpringKafka integration stays disabled.

💡 Motivation and Context

The Kafka auto-config gate only checked for SentryAutoConfigurationCustomizerProvider, which covered the app-classpath OTel integration but missed the Java agent path. As a result, the agent sample still installed SentryKafkaProducerBeanPostProcessor, and the coexistence test failed for the wrong reason.

Adding AgentMarker to the conditional fixes the real suppression bug and aligns the tests with the current OTel messaging mapping behavior.

💚 How did you test it?

  • Ran ./gradlew spotlessApply apiDump
  • Ran ./gradlew :sentry-spring-boot-jakarta:test --tests='*SentryKafkaAutoConfigurationTest' -x :sentry-spring-jakarta:compileJava -x :sentry-spring-jakarta:jar
  • Ran ./gradlew :sentry-spring-boot-jakarta:compileTestKotlin :sentry-samples:sentry-samples-spring-boot-jakarta-opentelemetry:compileTestKotlin :sentry-samples:sentry-samples-spring-boot-jakarta-opentelemetry-noagent:compileTestKotlin -x :sentry-spring-jakarta:compileJava -x :sentry-spring-jakarta:jar

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Continue moving the Queue Instrumentation stack toward a clean OTel coexistence story across the remaining samples.

#skip-changelog

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

This was referenced Apr 29, 2026
@sentry
Copy link
Copy Markdown

sentry Bot commented Apr 29, 2026

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.37.1 (1) release

⚙️ sentry-android Build Distribution Settings

@github-actions
Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 339.15 ms 390.35 ms 51.19 ms
Size 0 B 0 B 0 B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant