-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix KafkaTemplate hiding exceptions when starting observation #3779
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
Fix KafkaTemplate hiding exceptions when starting observation #3779
Conversation
|
@@ -805,8 +805,8 @@ private CompletableFuture<SendResult<K, V>> observeSend(final ProducerRecord<K, | |||
this.observationConvention, DefaultKafkaTemplateObservationConvention.INSTANCE, | |||
() -> new KafkaRecordSenderContext(producerRecord, this.beanName, this::clusterId), | |||
this.observationRegistry); | |||
observation.start(); |
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.
Yeah... Agreed.
I see similar pattern in the ObservedAspect
:
observation.start();
Observation.Scope scope = observation.openScope();
try {
Object result = pjp.proceed();
So, we indeed has to start an observation outside of the try..catch
block.
More easier to understand how that supposed to be used is in the well-known Observation.observe()
implementation:
default void observe(Runnable runnable) {
start();
try (Scope scope = openScope()) {
runnable.run();
}
catch (Throwable error) {
error(error);
throw error;
}
finally {
stop();
}
}
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.
Signed-off-by: cfredri4 [email protected]
While email might be real, we would prefer to see a real, official contributor name in the commit.
Any chances that you can fix your GH account and local Git respectively?
This is an Open Source, so everything has to be as open as possible with respective appreciation credits to contributors.
Thank you for the fix!
This fixes that exceptions thrown from observation.start() are hidden by KafkaTemplate throwing a new exception due to registering observation error without successfully starting the observation. Signed-off-by: Christian Fredriksson <[email protected]>
ec63436
to
91376de
Compare
The DCO check has failed with:
So, some else is off between your GH account and local Git. Either way that looks good to me and I'm accepting your contribution and merging it. Thank you again! |
Fixes: #3779 This fixes that exceptions thrown from `observation.start()` are hidden by `KafkaTemplate` throwing a new exception due to registering observation error without successfully starting the observation. Signed-off-by: Christian Fredriksson <[email protected]> (cherry picked from commit bdd1fd3)
Fixes: #3779 This fixes that exceptions thrown from `observation.start()` are hidden by `KafkaTemplate` throwing a new exception due to registering observation error without successfully starting the observation. Signed-off-by: Christian Fredriksson <[email protected]> (cherry picked from commit bdd1fd3)
This fixes that exceptions thrown from observation.start() are hidden by KafkaTemplate throwing a new exception due to registering observation error without successfully starting the observation.
Signed-off-by: Christian Fredriksson [email protected]