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

Adding traceId/spanId to accesslogs and applogs #112

Closed
withnale opened this issue Oct 23, 2018 · 1 comment
Closed

Adding traceId/spanId to accesslogs and applogs #112

withnale opened this issue Oct 23, 2018 · 1 comment

Comments

@withnale
Copy link

I've been following the various opentracing/jaeger/zipkin java client repos looking for some guidance on the cleanest way to get traceId/spanId into the logs. There has been some discussion in various places on this topic but nothing definitive and no code anywhere (unless I look in the brave implementation)

At present we are running our application inside a tomcat container, deployed as a war.

I've got basic span/trace forwarding working however I'd also like to enrich both our access logs and application logs so that these can also be used for diagnosis.

For application logs we are using logback and so my assumption is the cleanest way to manage this would be to write the relevant information into MDC and use logback native patterns to include the relevant fields.

For tomcat access logs, I would assume I would need to update the values into either the request or response context and use AccessLogValve patterns to pick this up.

However, I'm unsure of the best place to populate these. Should I write this functionality as an additional filter, or extend one of the existing classes? Is there any prior art I have missed that would make this easier?

@pavolloffay
Copy link
Collaborator

Hi, as the IDs are not exposed by the OT API you have to cast the context to the current impl to get them.

This will change in opentracing/opentracing-java#314.

I am closing this as it is not related to jax-rs. Feel free to continue the discussion.

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

No branches or pull requests

2 participants