add trace_id in logs to identify all logs related to a request/error#1982
Merged
add trace_id in logs to identify all logs related to a request/error#1982
Conversation
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Geal
approved these changes
Oct 26, 2022
garypen
approved these changes
Oct 26, 2022
Contributor
garypen
left a comment
There was a problem hiding this comment.
Nice work. It makes me a bit sad that we are internalising so much of the tracing formatting code, but hey ho...
Couple of small questions.
Contributor
Author
|
@garypen I agree with you about internalising some tracing formatting code. I'm still pretty happy because I didn't had to copy paste the biggest part of json formatter, only small parts. Also that's why I started a draft PR in tracing to be able to implement filtering upstream and get rid of that part of the code. |
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #1981
It automatically adds a
trace_idon logs to identify which log is related to a specific request. Also addstrace_idto an example error to have an example.This PR also refactor the way we handled formatters before, this refactor will let us be more flexible on which specific fields we want to display in logs. For now it keeps the current behavior which do not display any fields coming from current span and parent spans, only fields written directly in the log macro.
Example of an error response:
{ "data": {}, "errors": [ { "message": "HTTP fetch failed from 'accounts': HTTP fetch failed from 'accounts': error trying to connect: tcp connect error: Connection refused (os error 111)", "path": [], "extensions": { "type": "SubrequestHttpError", "service": "accounts", "reason": "HTTP fetch failed from 'accounts': error trying to connect: tcp connect error: Connection refused (os error 111)" } } ] }with response header:
with related logs: