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
Is your feature request related to a problem? Please describe.
Spring Kafka has two levels of error handling: listener error handlers and container error handlers. Unfortunately, by the time the latter is called, the scope is already closed. This is because RecordInterceptor::failure is called earlier in the error processing, and that's where opentelemetry closes the scope.
Describe the solution you'd like
The RecordInterceptor::afterRecord has been added for this reason (see this commit). Indeed, if you close the scope in afterRecord, the handler is still in the scope when it's called. Unfortunately, that method was added in spring-kafka 2.8.0, and I believe opentelemetry still supports 2.7. Additionally, afterRecord has no access to the error, so the error would have to be registered with the span in the failure method if possible.
Describe alternatives you've considered
Disabling spring-kafka instrumentation and using kafka instrumentation instead doesn't solve the issue, as TracingIterator's hasNext method is also called before the error handler.
A workaround is to take the traceparent header from the record in the error handler, and start the span manually.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Spring Kafka has two levels of error handling: listener error handlers and container error handlers. Unfortunately, by the time the latter is called, the scope is already closed. This is because
RecordInterceptor::failure
is called earlier in the error processing, and that's where opentelemetry closes the scope.Describe the solution you'd like
The
RecordInterceptor::afterRecord
has been added for this reason (see this commit). Indeed, if you close the scope inafterRecord
, the handler is still in the scope when it's called. Unfortunately, that method was added in spring-kafka 2.8.0, and I believe opentelemetry still supports 2.7. Additionally,afterRecord
has no access to the error, so the error would have to be registered with the span in thefailure
method if possible.Describe alternatives you've considered
Disabling spring-kafka instrumentation and using kafka instrumentation instead doesn't solve the issue, as TracingIterator's hasNext method is also called before the error handler.
A workaround is to take the traceparent header from the record in the error handler, and start the span manually.
Additional context
No response
The text was updated successfully, but these errors were encountered: