Skip to content

Conversation

@artembilan
Copy link
Member

@artembilan artembilan commented Dec 17, 2024

Fixes: #3686

According to our investigation around the try-with-resource, it looks like the resource is already closed when we reach the catch block.

  • Rework KafkaMessageListenerContainer.ListenerConsumer.doInvokeRecordListener() to observation.openScope() before the try and close it manually in the finally block

@artembilan artembilan changed the title GH-3686: Fix observation scope closure in the `KafkaMessageListenerCo… GH-3686: Fix observation scope closure in the KafkaMLContainer Dec 17, 2024
…Container`

Fixes: spring-projects#3686

According to our investigation around the `try-with-resource`,
it looks like the resource is already closed when we reach the `catch` block.

* Rework  `KafkaMessageListenerContainer.ListenerConsumer.doInvokeRecordListener()`
to `observation.openScope()` before the `try` and close it manually in the `finally` block
* Verify `RecordInterceptor.failure()` has a scope in the `ObservationTests`
@sobychacko sobychacko merged commit 6e03b47 into spring-projects:main Dec 17, 2024
3 checks passed
@artembilan artembilan deleted the GH-3686 branch December 19, 2024 15:33
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.

KafkaMessageListenerContainer Observation Scope seems to be setup incorrectly

2 participants