-
Notifications
You must be signed in to change notification settings - Fork 245
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
Enable displaying trace and span id on logs #4823
Conversation
This comment has been minimized.
This comment has been minimized.
CI performance tests
|
86e9020
to
6e84c39
Compare
docs/source/configuration/telemetry/exporters/logging/stdout.mdx
Outdated
Show resolved
Hide resolved
To enable correlation between trace and logs trace_id and span_id should be included on the log messages. Json: ``` {"timestamp":"2024-03-19T15:37:41.516453239Z","level":"INFO","trace_id":"54ac7e5f0e8ab90ae67b822e95ffcbb8","span_id":"9b3f88c602de0ceb","message":"Supergraph GraphQL response"..... ``` Text: ``` 2024-03-19T15:14:46.040435Z INFO trace_id: bbafc3f048b6137375dd78c10df18f50 span_id: 40ede28c5df1b5cc router{ ``` Configuration options have been added in logging for text and json formats defaulting to true. Json: ``` exporters: logging: stdout: format: json: display_span_id: true display_trace_id: true ``` Text: ``` exporters: logging: stdout: format: text: display_span_id: false display_trace_id: false ```
c6afe84
to
f70366f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks fine but do we want to activate by default 2 new high cardinality fields in the logs? Wouldn't that surprise users?
| this looks fine but do we want to activate by default 2 new high cardinality fields in the logs? Wouldn't that surprise users? I see your point, but for instance New Relic and Datadog expect trace attributes to be on log messages, and the otel spec details that they should be there https://opentelemetry.io/docs/specs/otel/compatibility/logging_trace_context/#json-formats. I think this'll give a better experience for the majority of users, and for logs carnality doesn't really matter. |
@BrynCooke trying to understand how this PR interacts with this one: |
@BrynCooke How to work with existing eg. I was trying to override |
@Samjin I think you should use trace propagation for this use case https://www.apollographql.com/docs/router/configuration/telemetry/exporters/tracing/overview#propagation |
Just tried it out with request header of |
Create a ticket to override default trace_id. #5056 |
To enable correlation between trace and logs trace_id and span_id should be included on the log messages.
Json:
Text:
Configuration options have been added in logging for text and json formats defaulting to true for json and false for text.
Json:
Text:
Checklist
Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.
Exceptions
Note any exceptions here
Notes
Footnotes
It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. ↩
Configuration is an important part of many changes. Where applicable please try to document configuration examples. ↩
Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions. ↩