Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I configure the library to log the flow id? #703

Open
iav0207 opened this issue Mar 7, 2022 · 3 comments
Open

Can I configure the library to log the flow id? #703

iav0207 opened this issue Mar 7, 2022 · 3 comments
Labels

Comments

@iav0207
Copy link

iav0207 commented Mar 7, 2022

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")
@iav0207 iav0207 added the Feature label Mar 7, 2022
@zeitlinger
Copy link
Contributor

This feature is described here.

Maybe a cross-link would have helped you? If so, where?
A PR is highly welcome, BTW 😄

@iav0207
Copy link
Author

iav0207 commented Mar 9, 2022

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.

@karannagi
Copy link
Contributor

@iav0207 try the pattern [%X{flow_id}] in your logback to get the flowid logged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants