Skip to content

Conversation

@artembilan
Copy link
Member

Fixes #2817

An observation in KafkaTemplate can be marked with error from a Callback. Then Future is evaluated and its exception is thrown back to the observeSend(). Here this exception is caught and reported to the observation again. This creates a second timer in the Micrometer, but with different error tag

  • Check for error presence in the observeSend() catch block and skip second report

Cherry-pick to 3.0.x

Fixes spring-projects#2817

An observation in `KafkaTemplate` can be marked with error from a `Callback`.
Then `Future` is evaluated and its exception is thrown back to the `observeSend()`.
Here this exception is caught and reported to the observation again.
This creates a second timer in the Micrometer, but with different error tag

* Check for error presence in the `observeSend()` `catch` block and skip
second report

**Cherry-pick to `3.0.x`**
@garyrussell garyrussell merged commit b212b4d into spring-projects:main Sep 25, 2023
garyrussell pushed a commit that referenced this pull request Sep 25, 2023
* GH-2817: KafkaTemplate: No double error timers

Fixes #2817

An observation in `KafkaTemplate` can be marked with error from a `Callback`.
Then `Future` is evaluated and its exception is thrown back to the `observeSend()`.
Here this exception is caught and reported to the observation again.
This creates a second timer in the Micrometer, but with different error tag

* Check for error presence in the `observeSend()` `catch` block and skip
second report

**Cherry-pick to `3.0.x`**

* * Fix import order for Checkstyle rule
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.

KafkaTemplate is reporting 2 errors to observation on immediate errors (one in callback and one in catched exception from the same callback)

2 participants