-
-
Notifications
You must be signed in to change notification settings - Fork 467
feat(spring-boot-jakarta): [Queue Instrumentation 5] Add Kafka queue auto-configuration #5259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
adinauer
wants to merge
4
commits into
feat/queue-instrumentation-consumer
Choose a base branch
from
feat/queue-instrumentation-autoconfig
base: feat/queue-instrumentation-consumer
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
572dc2d
feat(spring-boot-jakarta): Add Kafka queue auto-configuration
adinauer 04a4689
changelog
adinauer ce87037
Merge branch 'feat/queue-instrumentation-consumer' into feat/queue-inโฆ
adinauer b8ead5f
Merge branch 'feat/queue-instrumentation-consumer' into feat/queue-inโฆ
adinauer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryKafkaAutoConfigurationTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| package io.sentry.spring.boot.jakarta | ||
|
|
||
| import io.sentry.spring.jakarta.kafka.SentryKafkaConsumerBeanPostProcessor | ||
| import io.sentry.spring.jakarta.kafka.SentryKafkaProducerBeanPostProcessor | ||
| import kotlin.test.Test | ||
| import org.assertj.core.api.Assertions.assertThat | ||
| import org.springframework.boot.autoconfigure.AutoConfigurations | ||
| import org.springframework.boot.test.context.runner.ApplicationContextRunner | ||
|
|
||
| class SentryKafkaAutoConfigurationTest { | ||
|
|
||
| private val contextRunner = | ||
| ApplicationContextRunner() | ||
| .withConfiguration(AutoConfigurations.of(SentryAutoConfiguration::class.java)) | ||
| .withPropertyValues( | ||
| "sentry.dsn=http://key@localhost/proj", | ||
| "sentry.traces-sample-rate=1.0", | ||
| "sentry.shutdownTimeoutMillis=0", | ||
| "sentry.sessionFlushTimeoutMillis=0", | ||
| "sentry.flushTimeoutMillis=0", | ||
| "sentry.readTimeoutMillis=50", | ||
| "sentry.connectionTimeoutMillis=50", | ||
| "sentry.send-modules=false", | ||
| "sentry.debug=false", | ||
| ) | ||
|
|
||
| @Test | ||
| fun `registers Kafka BPPs when queue tracing is enabled`() { | ||
| contextRunner.withPropertyValues("sentry.enable-queue-tracing=true").run { context -> | ||
| assertThat(context).hasSingleBean(SentryKafkaProducerBeanPostProcessor::class.java) | ||
| assertThat(context).hasSingleBean(SentryKafkaConsumerBeanPostProcessor::class.java) | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun `does not register Kafka BPPs when queue tracing is disabled`() { | ||
| contextRunner.run { context -> | ||
| assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) | ||
| assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun `does not register Kafka BPPs when queue tracing is explicitly false`() { | ||
| contextRunner.withPropertyValues("sentry.enable-queue-tracing=false").run { context -> | ||
| assertThat(context).doesNotHaveBean(SentryKafkaProducerBeanPostProcessor::class.java) | ||
| assertThat(context).doesNotHaveBean(SentryKafkaConsumerBeanPostProcessor::class.java) | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a test for the case when KafkaTemplate is not on the classpath but queue tracing is enabled?