Skip to content

feat(samples): [Queue Instrumentation 15] Add opt-in Kafka console e2e coverage#5289

Draft
adinauer wants to merge 9 commits intofeat/queue-instrumentation-kafka-modulefrom
feat/queue-instrumentation-kafka-console-sample
Draft

feat(samples): [Queue Instrumentation 15] Add opt-in Kafka console e2e coverage#5289
adinauer wants to merge 9 commits intofeat/queue-instrumentation-kafka-modulefrom
feat/queue-instrumentation-kafka-console-sample

Conversation

@adinauer
Copy link
Copy Markdown
Member

@adinauer adinauer commented Apr 13, 2026

PR Stack (Queue Instrumentation)


📜 Description

Add console-sample Kafka coverage for queue instrumentation and make the sample’s Kafka flow opt-in so existing system tests stay stable when Kafka is not available.

This PR includes:

  • a dedicated KafkaShowcase flow in the console sample
  • a no-arg producer interceptor constructor path used by Kafka config loading
  • a consumer demo path so both producer and consumer queue spans are exercised
  • a system test path that enables Kafka only when SENTRY_SAMPLE_KAFKA_BOOTSTRAP_SERVERS is set

💡 Motivation and Context

After extracting sentry-kafka into a standalone module, we need end-to-end coverage outside Spring to validate queue span creation and trace propagation for plain kafka-clients usage.

💚 How did you test it?

  • Ran ./gradlew spotlessApply apiDump
  • Added/updated tests in sentry-kafka for producer and consumer interceptors
  • Added console sample system test coverage for Kafka-enabled flow

📝 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

#skip-changelog

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

adinauer and others added 4 commits April 13, 2026 14:19
Allow kafka-clients to instantiate SentryKafkaProducerInterceptor via interceptor.classes by adding a no-arg constructor that uses ScopesAdapter. This makes native Kafka interceptor wiring work out of the box in applications and samples.\n\nAlso add a Kafka tracing example to the console sample with a transaction-scoped producer send, and cover no-arg constructor behavior in sentry-kafka tests.

Co-Authored-By: Claude <noreply@anthropic.com>
Show end-to-end Kafka queue tracing in the console sample by running a background consumer thread, producing a message, and waiting for consume before exit.\n\nAdd a no-arg constructor to SentryKafkaConsumerInterceptor so kafka-clients can instantiate it from interceptor.classes, and add test coverage for that constructor.

Co-Authored-By: Claude <noreply@anthropic.com>
Move Kafka producer/consumer showcase logic out of Main into KafkaShowcase to make the sample easier to read and follow. Keep runtime behavior unchanged by preserving the same demo entry point and flow.

Co-Authored-By: Claude <noreply@anthropic.com>
Gate the console Kafka showcase behind SENTRY_SAMPLE_KAFKA_BOOTSTRAP_SERVERS so Kafka behavior is enabled only when configured. Keep the showcase isolated in KafkaShowcase and use fail-fast Kafka client timeouts for local runs.\n\nExtend console system tests to assert producer and consumer queue tracing when Kafka is enabled. Update system-test-runner to provision or reuse a local Kafka broker for the console module and clean up runner-managed resources.

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

🟡 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).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

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

Generated by 🚫 dangerJS against 7661f6c

@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

adinauer and others added 5 commits April 13, 2026 18:33
Move KafkaShowcase under io.sentry.samples.console.kafka and update Main to
import the relocated class.

This keeps Kafka-specific sample code grouped in a dedicated package
without changing runtime behavior.

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

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 314.83 ms 352.65 ms 37.81 ms
Size 0 B 0 B 0 B

Baseline results on branch: feat/queue-instrumentation-kafka-module

Startup times

Revision Plain With Sentry Diff
e569007 309.33 ms 348.62 ms 39.29 ms

App size

Revision Plain With Sentry Diff
e569007 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.

2 participants