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

correlation id in response header #177

Closed
lsntomaszw opened this issue Aug 23, 2017 · 3 comments
Closed

correlation id in response header #177

lsntomaszw opened this issue Aug 23, 2017 · 3 comments

Comments

@lsntomaszw
Copy link

Is there any way to return correlation Id not just in log, but also in response? Having that value in response (header) will allow developers / testers to provide id of the request/response that should be tracked for bugs etc.

@lukasniemeier-zalando
Copy link
Member

Does https://github.com/zalando/tracer solve your problem? Using it a trace can span more than just a single request-response-pair.

@lsntomaszw
Copy link
Author

I've just tried, and this is what I understand:

  • tracer adds header in response X-Trace-ID
  • logbook log this header in headers section
  • still logged request doesn't have X-Trace-ID (from logbook) in headers section

so - that makes it a bit difficult to join:

  • need to know X-Trace-ID
  • from X-Trace-ID we need to search for logged response,
  • get correlation attribute from response
  • search for request with the same correlation

the best option would be to have correlation attribute from logbook in each response header (then we won't need tracer and additional X-Trace-ID)

@whiskeysierra
Copy link
Collaborator

@lsntomaszw Sorry for the late response:

tracer adds header in response X-Trace-ID

It also adds it to the request, if it's not already present. Therefore the following statement is incorrect:

still logged request doesn't have X-Trace-ID (from logbook) in headers section

In order to make this setup work you need to register the TracerFilter before the LogbookFilter.

the best option would be to have correlation attribute from logbook in each response header (then we won't need tracer and additional X-Trace-ID)

That would be too invasive for logbook. The purpose of the library is to log traffic, not change it. Tracer is the best match for your use case. All you need to know is the trace id. Either the client got it back as a response or they already provided it themselves with the initial request. Either way, you'll have it.

The following doc explains why we have correlation id in the first place: https://github.com/zalando/logbook/blob/master/docs/scalyr.md

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

3 participants