opentracing-toolbox
opentracing-toolbox copied to clipboard
Can I configure the library to log the flow id?
I found no docs or examples throughout many projects on how to put the flow id in the logging pattern. Here I mean the ordinary logging as in Logback or similar, not the opentracing logs.
Detailed Description
In the deprecated zalando/tracer
library one could trivially achieve it: the value of X-Flow-ID
was present in the slf4j MDC and could be referenced to enhance the logging pattern like this.
If there is such a possibility it should be documented. Otherwise, it could be mentioned in the readme that this is not supported out of the box.
Context
Having flow ids in logs increases traceability of the logs. A more complete documentation in this part can save hours of discovery for users.
Possible Implementation
Your Environment
Kotlin Spring Boot Webflux Logback
implementation("org.zalando:opentracing-spring-webflux-extension-starter:4.0.3")
implementation("org.zalando:opentracing-kotlin:4.0.3")
implementation("org.zalando:opentracing-flowid:4.0.3")
implementation("org.zalando:opentracing-flowid-autoconfigure:4.0.3")
This feature is described here.
Maybe a cross-link would have helped you? If so, where? A PR is highly welcome, BTW :smile:
Hi @zeitlinger ,
Thanks for the link, I was initially looking for the info in flowid
module. I will add a link there. I would be happy to open a PR once I figure out how to solve my problem.
The description of log correlation config still does not explain how to get flow ids logged. The configuration given there does not add flow_id
entry to the slf4j's MDC when I try it.
The way of configuring it however gave me at least something to search for in Github, and I see various ways to configure flow id logging now and trying to get it working in my project. No success yet.
@iav0207 try the pattern [%X{flow_id}]
in your logback to get the flowid logged.