Skip to content

ref(kafka): [Queue Instrumentation 14] Extract sentry-kafka module#5288

Draft
adinauer wants to merge 2 commits intofix/queue-instrumentation-enqueued-time-secondsfrom
feat/queue-instrumentation-kafka-module
Draft

ref(kafka): [Queue Instrumentation 14] Extract sentry-kafka module#5288
adinauer wants to merge 2 commits intofix/queue-instrumentation-enqueued-time-secondsfrom
feat/queue-instrumentation-kafka-module

Conversation

@adinauer
Copy link
Copy Markdown
Member

@adinauer adinauer commented Apr 13, 2026

PR Stack (Queue Instrumentation)


📜 Description

Extract Kafka interceptors into a standalone sentry-kafka module so that non-Spring applications using kafka-clients directly can get queue instrumentation.

  • Move SentryProducerInterceptorSentryKafkaProducerInterceptor in sentry-kafka
  • Add SentryKafkaConsumerInterceptor for vanilla Kafka consumers (creates queue.receive transactions with trace propagation)
  • sentry-spring-jakarta now depends on sentry-kafka and passes a Spring-specific trace origin
  • Register new auto.queue.kafka.producer and auto.queue.kafka.consumer span origins

💡 Motivation and Context

The Kafka queue instrumentation was previously only available through the Spring integration. Plain kafka-clients users had no way to use it. This extraction makes the interceptors reusable outside Spring via standard Kafka interceptor configuration.

💚 How did you test it?

  • Unit tests for SentryKafkaConsumerInterceptor and SentryKafkaProducerInterceptor in the new module
  • Existing Spring Kafka tests updated to use the renamed classes

📝 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

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

Move Kafka producer interceptor to a new sentry-kafka module and rename
to SentryKafkaProducerInterceptor. Add SentryKafkaConsumerInterceptor
for vanilla kafka-clients users. Spring integration now depends on
sentry-kafka and passes a Spring-specific trace origin.

This allows non-Spring applications to use Kafka queue instrumentation
directly via kafka-clients interceptor config.

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

github-actions bot commented Apr 13, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 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
  • (samples) [Queue Instrumentation 2] Add Kafka to Spring Boot 3 sample app by adinauer in #5253
  • (spring-boot-jakarta) [Queue Instrumentation 5] Add Kafka queue auto-configuration by adinauer in #5256
  • 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

  • (kafka) [Queue Instrumentation 14] Extract sentry-kafka module by adinauer in #5288
  • (samples) [Queue Instrumentation 6] Add Kafka queue system tests by adinauer in #5260
  • Add THIRD_PARTY_NOTICES.md for vendored third-party code by markushi in #5186

🤖 This preview updates automatically when you update the PR.

@sentry
Copy link
Copy Markdown

sentry bot commented Apr 13, 2026

Sentry Build Distribution

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

Configure sentry-android build distribution settings

@github-actions
Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 309.33 ms 348.62 ms 39.29 ms
Size 0 B 0 B 0 B

Baseline results on branch: fix/queue-instrumentation-enqueued-time-seconds

Startup times

Revision Plain With Sentry Diff
789996b 330.43 ms 392.48 ms 62.05 ms

App size

Revision Plain With Sentry Diff
789996b 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