Skip to content

feat(spring): [Queue Instrumentation 40] Add Spring Boot 4 Kafka tracing#5348

Open
adinauer wants to merge 5 commits intofeat/queue-instrumentationfrom
feat/queue-instrumentation-spring-boot-4
Open

feat(spring): [Queue Instrumentation 40] Add Spring Boot 4 Kafka tracing#5348
adinauer wants to merge 5 commits intofeat/queue-instrumentationfrom
feat/queue-instrumentation-spring-boot-4

Conversation

@adinauer
Copy link
Copy Markdown
Member

@adinauer adinauer commented Apr 29, 2026

PR Stack (Queue Instrumentation)


📜 Description

Ports the Spring Boot 3 Kafka queue tracing stack changes to Spring Boot 4 as one PR.

This adds Spring Kafka support to the Spring 7 module, wires it into the Spring Boot 4 auto-configuration, and adds Boot 4 sample/system-test coverage for the regular, OTel agent, and OTel no-agent samples.

💡 Motivation and Context

The queue instrumentation stack added Kafka tracing for Spring Boot 3. Spring Boot 4 uses the Spring 7 module, so it needs the same Kafka producer/consumer bean post-processors and auto-configuration in the Boot 4 integration.

💚 How did you test it?

  • ./gradlew spotlessApply apiDump
  • ./gradlew :sentry-spring-7:test --tests '*Kafka*' :sentry-spring-boot-4:test --tests '*Kafka*'
  • ./gradlew :sentry-samples:sentry-samples-spring-boot-4:compileJava :sentry-samples:sentry-samples-spring-boot-4:compileTestKotlin :sentry-samples:sentry-samples-spring-boot-4-opentelemetry:compileJava :sentry-samples:sentry-samples-spring-boot-4-opentelemetry:compileTestKotlin :sentry-samples:sentry-samples-spring-boot-4-opentelemetry-noagent:compileJava :sentry-samples:sentry-samples-spring-boot-4-opentelemetry-noagent:compileTestKotlin
  • python3 -m py_compile test/system-test-runner.py

📝 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

None.

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

Port the Spring Boot 3 Kafka queue tracing support to the Spring 7 and Spring Boot 4 modules.

Add Spring Kafka bean post-processors, Boot 4 auto-configuration, and matching sample system-test coverage.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 4c3f5cd

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

github-actions Bot commented Apr 29, 2026

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 377.17 ms 429.49 ms 52.32 ms
Size 0 B 0 B 0 B

Baseline results on branch: feat/queue-instrumentation

Startup times

Revision Plain With Sentry Diff
e520524 303.16 ms 350.26 ms 47.10 ms

App size

Revision Plain With Sentry Diff
e520524 0 B 0 B 0 B

Previous results on branch: feat/queue-instrumentation-spring-boot-4

Startup times

Revision Plain With Sentry Diff
1a9b19e 323.42 ms 368.73 ms 45.31 ms
ce27249 350.50 ms 432.16 ms 81.66 ms

App size

Revision Plain With Sentry Diff
1a9b19e 0 B 0 B 0 B
ce27249 0 B 0 B 0 B

@adinauer adinauer marked this pull request as ready for review April 29, 2026 13:10
Base automatically changed from fix/kafka-system-test-stale-container to feat/queue-instrumentation May 5, 2026 11:10
adinauer and others added 2 commits May 5, 2026 13:43
Simplify Kafka interceptor test delegates and rely on Kotlin type inference in Spring Kafka tests.

Co-Authored-By: Claude <noreply@anthropic.com>
Initialize Sentry before each Kafka bean post-processor test and close it afterwards so logging paths do not depend on test execution order. This prevents failures when earlier tests close the SDK before these tests run.

Co-Authored-By: Claude <noreply@anthropic.com>
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.

2 participants