Skip to content

feat(spring-boot-jakarta): [Queue Instrumentation 5] Add Kafka queue auto-configuration#5259

Draft
adinauer wants to merge 2 commits intofeat/queue-instrumentation-consumerfrom
feat/queue-instrumentation-autoconfig
Draft

feat(spring-boot-jakarta): [Queue Instrumentation 5] Add Kafka queue auto-configuration#5259
adinauer wants to merge 2 commits intofeat/queue-instrumentation-consumerfrom
feat/queue-instrumentation-autoconfig

Conversation

@adinauer
Copy link
Copy Markdown
Member

@adinauer adinauer commented Apr 2, 2026

PR Stack (Queue Instrumentation)


📜 Description

Add Spring Boot 3 auto-configuration for Kafka queue instrumentation:

  • SentryKafkaQueueConfiguration nested in SentryAutoConfiguration:
    • @ConditionalOnClass(KafkaTemplate.class) — only activates when spring-kafka is on the classpath
    • @ConditionalOnProperty(name = "sentry.enable-queue-tracing", havingValue = "true") — opt-in
    • Registers SentryKafkaProducerBeanPostProcessor (wraps KafkaTemplate for queue.publish spans)
    • Registers SentryKafkaConsumerBeanPostProcessor (adds SentryKafkaRecordInterceptor for queue.process transactions)
    • Reports SpringKafka integration via SentryIntegrationPackageStorage

Follows the same pattern as SentryCacheConfiguration.

💡 Motivation and Context

PR 5 in the Queue Instrumentation stack. Thin wiring layer that activates the producer (PR 3) and consumer (PR 4) instrumentation via Spring Boot auto-configuration. Users just need sentry.enable-queue-tracing=true in their properties.

💚 How did you test it?

  • Auto-configuration context tests: beans registered when enabled, absent when disabled or explicitly false
  • ./gradlew :sentry-spring-boot-jakarta:test --tests="*SentryKafkaAutoConfiguration*" — 3 tests pass

📝 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

  • PR 6: System tests (e2e) for Spring Boot 3 Kafka

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

adinauer and others added 2 commits April 1, 2026 16:35
Register SentryKafkaProducerBeanPostProcessor and
SentryKafkaConsumerBeanPostProcessor when spring-kafka is on the
classpath and sentry.enable-queue-tracing=true. Follows the same
pattern as SentryCacheConfiguration.

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

github-actions bot commented Apr 2, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Spring Jakarta

  • [Queue Instrumentation 4] Add Kafka consumer instrumentation by adinauer in #5255
  • [Queue Instrumentation 3] Add Kafka producer instrumentation by adinauer in #5254

Other

  • (core) [Queue Instrumentation 1] Add enableQueueTracing option and messaging span data conventions by adinauer in #5250
  • (spring-boot-jakarta) [Queue Instrumentation 5] Add Kafka queue auto-configuration by adinauer in #5259
  • Add strict trace continuation support by giortzisg in #5136
  • Sync file attachments to native by bitsandfoxes in #5211

Internal Changes 🔧

Deps

  • Bump requests from 2.32.4 to 2.33.0 in the uv group across 1 directory by dependabot in #5237
  • Bump github/codeql-action from 4.32.6 to 4.35.1 by dependabot in #5243

Other

  • Add THIRD_PARTY_NOTICES.md for vendored third-party code by markushi in #5186

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Features

- [Queue Instrumentation 5] Add Kafka queue auto-configuration ([#5259](https://github.com/getsentry/sentry-java/pull/5259))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against 04a4689

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 325.13 ms 383.40 ms 58.27 ms
Size 0 B 0 B 0 B

Baseline results on branch: feat/queue-instrumentation-consumer

Startup times

Revision Plain With Sentry Diff
651abdc 250.50 ms 320.04 ms 69.54 ms

App size

Revision Plain With Sentry Diff
651abdc 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