-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Listener exceptions not saved to the observation #3049
Milestone
Comments
Faced with the same issue in By the way, micrometer meters are updated on each listener invocation retry. |
sobychacko
added
for: backport-to-3.1.x
backport-to-3.0.x (obsolete)
and removed
status: waiting-for-triage
labels
Feb 26, 2024
Wzy19930507
added a commit
to Wzy19930507/spring-kafka
that referenced
this issue
Feb 28, 2024
* Embedded the (original) exception into the observation, allowing downstream tracing code to handle it. * Add unit test for observation Error and RuntimeException. Resolves spring-projects#3049
artembilan
pushed a commit
that referenced
this issue
Feb 29, 2024
Fixes: #3049 Listener exceptions are not saved to the observation. * Embedded the (original) exception into the observation, allowing downstream tracing code to handle it. * Add unit test for observation `Error` and `RuntimeException`. * Unify the `runtimeExceptionTemplate` and `errorTemplate` into a `throwableTemplate`. **Auto-cherry-pick to `3.1.x` & `3.0.x`**
spring-builds
pushed a commit
that referenced
this issue
Feb 29, 2024
Fixes: #3049 Listener exceptions are not saved to the observation. * Embedded the (original) exception into the observation, allowing downstream tracing code to handle it. * Add unit test for observation `Error` and `RuntimeException`. * Unify the `runtimeExceptionTemplate` and `errorTemplate` into a `throwableTemplate`. (cherry picked from commit 61016db)
spring-builds
pushed a commit
that referenced
this issue
Feb 29, 2024
Fixes: #3049 Listener exceptions are not saved to the observation. * Embedded the (original) exception into the observation, allowing downstream tracing code to handle it. * Add unit test for observation `Error` and `RuntimeException`. * Unify the `runtimeExceptionTemplate` and `errorTemplate` into a `throwableTemplate`. (cherry picked from commit 61016db)
This was referenced Feb 29, 2024
artembilan
added a commit
that referenced
this issue
Mar 22, 2024
Fixes: #3151 After fixing #3049 we are missing an `ErrorHandler` part within an observation. This even cause a retryable topic logic ot be out of an observation scope. * Restore the previous behavior and add `observation.error(e)` when it is not re-thrown in case of `this.commonErrorHandler` presence **Auto-cherry-pick to `3.1.x` & `3.0.x`**
spring-builds
pushed a commit
that referenced
this issue
Mar 22, 2024
Fixes: #3151 After fixing #3049 we are missing an `ErrorHandler` part within an observation. This even cause a retryable topic logic ot be out of an observation scope. * Restore the previous behavior and add `observation.error(e)` when it is not re-thrown in case of `this.commonErrorHandler` presence (cherry picked from commit c24575c)
spring-builds
pushed a commit
that referenced
this issue
Mar 22, 2024
Fixes: #3151 After fixing #3049 we are missing an `ErrorHandler` part within an observation. This even cause a retryable topic logic ot be out of an observation scope. * Restore the previous behavior and add `observation.error(e)` when it is not re-thrown in case of `this.commonErrorHandler` presence (cherry picked from commit c24575c)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In what version(s) of Spring for Apache Kafka are you seeing this issue?
org.springframework.kafka:spring-kafka:3.1.1
org.apache.kafka:kafka-clients:3.6.1
Describe the bug
When an exception is thrown from a listener, by default the exception is not saved in the current listener observation.
spring-kafka/spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java
Lines 2759 to 2794 in 22764cb
Observation#observe
would do it on its own, but then the provided supplier has to re-throw the exception rather than just return it, which it probably does forListenerConsumer#invokeInTransaction
.To Reproduce
java.lang.NullPointerException
.)Expected behavior
The error handler is invoked and all, but on top of that, the (original) exception is embedded into the observation, allowing downstream tracing code to handle it.
Sample
For simplicity's sake, I will only leave the listener code here. In the configuration, there is only a consumer group identifier. Let me know if I should make this into a repository.
The text was updated successfully, but these errors were encountered: