spring-cloud / spring-cloud/spring-cloud-stream
Trace ID logging inconsistencies across kafka binder and reactor kafka binder
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 646
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 8
Description
Hi,
I have created the prototype https://github.com/davidmelia/spring-boot-kafka-consumer-tracing to illustrate an issue summarised by
- Trace ID is output OK in the kafka binder depending on where the log statement is in the reactor chain.
- Trace ID is not output in the reactor kafka binder
If you follow the README after hitting http://localhost:8080/sendMessage you will see
... INFO [aid=spring-boot-kafka-consumer-tracing,tid=,sid=,cusname=] 36173 --- [-f567995d3b2a-1] c.e.demo.consumer.TestMessagesConsumer : Reactor Kafka Binder: This log statement does not have the trace id
... INFO [aid=spring-boot-kafka-consumer-tracing,tid=63e4bb48fde4e7bad38152c80451f3e1,sid=7a6ca04b1324a87c,cusname=My Name] 36173 --- [container-0-C-1] c.e.demo.consumer.TestMessagesConsumer : Kafka Binder: This log statement has the trace id
... INFO [aid=spring-boot-kafka-consumer-tracing,tid=,sid=,cusname=] 36173 --- [ parallel-4] c.e.demo.consumer.TestMessagesConsumer : Reactor Kafka Binder: This log statement does not have the trace id
... INFO [aid=spring-boot-kafka-consumer-tracing,tid=,sid=,cusname=] 36173 --- [ parallel-5] c.e.demo.consumer.TestMessagesConsumer : Kafka Binder: This log statement does not have the trace id
I have found no way to get the reactor kafka binder to log the trace ID nor can I get the following statement to log the trace ID in any binder
return Mono.just("OK").delayElement(Duration.ofMillis(10)).doOnSuccess(r -> log.info(...);
Thanks
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked prototype README and reproduce the behavior by calling http://localhost:8080/sendMessage. Compare trace-ID logging in the Kafka binder and Reactor Kafka binder, including the delayed Mono case; done means the affected log statements consistently include the trace ID or the limitation is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kafka, spring
- Domain
- backend, stream-processing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100