You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In what version(s) of Spring for Apache Kafka are you seeing this issue?
3.0.7
Describe the bug
When KafkaTemplate sends message which immediately fails (for example because of TopicAuthorizationException) then it will report two exceptions to observation:
one in callback,
one in catched exception which is thrown in doSend() method after checking that (sendFuture.isDone()) - original exception is then wrapped with KafkaException and thrown (throw new KafkaException("Send failed", e.getCause())) - this exception is then caught in observeSend method and reported to observation again (but this time wrapped KafkaException is reported)
So now after such 1 failure I see two metric counters increased, one with original exception for example TopicAuthorizationException and another with KafkaException which is not perfect because I had just one fail.
To Reproduce
It is easy to reproduce by sending message to wrongly named topic, assuming auto create topics is possible on kafka:
kafkaTemplate.send("wrong%Topic", "data")
This will cause 2 counters increased: one for InvalidTopicException and KafkaException.
Expected behavior
Only one error (Exception) is reported to observation which results in just one counter increased.
The text was updated successfully, but these errors were encountered:
Fixesspring-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`**
* 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
* 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
In what version(s) of Spring for Apache Kafka are you seeing this issue?
3.0.7
Describe the bug
When KafkaTemplate sends message which immediately fails (for example because of TopicAuthorizationException) then it will report two exceptions to observation:
So now after such 1 failure I see two metric counters increased, one with original exception for example TopicAuthorizationException and another with KafkaException which is not perfect because I had just one fail.
To Reproduce
It is easy to reproduce by sending message to wrongly named topic, assuming auto create topics is possible on kafka:
kafkaTemplate.send("wrong%Topic", "data")
This will cause 2 counters increased: one for InvalidTopicException and KafkaException.
Expected behavior
Only one error (Exception) is reported to observation which results in just one counter increased.
The text was updated successfully, but these errors were encountered: