Skip to content

Commit bdd1fd3

Browse files
authored
GH-3779: Fix KafkaTemplate from hiding error when starting observation
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]> **Auto-cherry-pick to `3.3.x` & `3.2.x`**
1 parent cbbd1d4 commit bdd1fd3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-kafka/src/main/java/org/springframework/kafka/core/KafkaTemplate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,8 @@ private CompletableFuture<SendResult<K, V>> observeSend(final ProducerRecord<K,
805805
this.observationConvention, DefaultKafkaTemplateObservationConvention.INSTANCE,
806806
() -> new KafkaRecordSenderContext(producerRecord, this.beanName, this::clusterId),
807807
this.observationRegistry);
808+
observation.start();
808809
try {
809-
observation.start();
810810
try (Observation.Scope ignored = observation.openScope()) {
811811
return doSend(producerRecord, observation);
812812
}

0 commit comments

Comments
 (0)