Closed ferblaca closed 2 months ago
@ferblaca We will look into it. Thanks for the sample.
@ferblaca This is by design and works as expected. Spring for Apache Kafka does not support tracing on batch listeners; it is only supported for record listeners. This is because, in a batch listener, the received records could be from multiple topics/partitions and from multiple producers where adding tracing information was optional. Since there may not be any correlations between records in the batch, the framework cannot make any assumptions about tracing them, such as providing them as a single trace ID, etc. If you convert the type signature of your listener as Message<List<String>>
, you can then get a header called kafka_batchConvertedHeaders
, which contains a list with the same number of entries as your payload. This list has a Map
that contains the tracing headers (traceparent
). However, it is up to the application to iterate over this properly and start an observation; the framework cannot do that. On the other hand, if you end up doing this, then why can't you consume the records in record mode and receive the implicit tracing capabilities available through the framework? CC @artembilan for any further insights.
Ok @sobychacko , It would be great to indicate this part in the documentation to avoid confusion.
Thank you very much!
Describe the issue Distributed traceability does not seem to be working properly for Kafka consumers in batch mode.
To Reproduce Steps to reproduce the behavior:
Version of the framework
Expected behavior
Additional context For consumers who are not in batch mode it works correctly.