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

feat: winston instrumentation #425

Merged
merged 7 commits into from
Apr 19, 2021
Merged

feat: winston instrumentation #425

merged 7 commits into from
Apr 19, 2021

Conversation

seemk
Copy link
Contributor

@seemk seemk commented Apr 15, 2021

Which problem is this PR solving?

Similarly to bunyan (#419), adds trace context to log metadata fields.

Short description of the changes

Injects trace_id, span_id, trace_flags to winston log metadata.

Note that testing with older winston versions (1.1.2 and 2.4.4) was done manually. To help with testing in the future, see open-telemetry/opentelemetry-js#2110

@seemk seemk requested a review from a team April 15, 2021 13:54
@codecov
Copy link

codecov bot commented Apr 15, 2021

Codecov Report

Merging #425 (8594d81) into main (692932e) will not change coverage.
The diff coverage is n/a.

❗ Current head 8594d81 differs from pull request most recent head 63ea62e. Consider uploading reports for the commit 63ea62e to get more accurate results

@@           Coverage Diff           @@
##             main     #425   +/-   ##
=======================================
  Coverage   95.83%   95.83%           
=======================================
  Files          15       15           
  Lines         624      624           
  Branches       94       94           
=======================================
  Hits          598      598           
  Misses         26       26           

@vmarchaud vmarchaud requested a review from a team April 15, 2021 14:37
Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice piece of work, thx for contribution

Would you be able to include the screenshots to show how the spans look like, can be in this or separate PR ?

@seemk
Copy link
Contributor Author

seemk commented Apr 17, 2021

This is really nice piece of work, thx for contribution

Would you be able to include the screenshots to show how the spans look like, can be in this or separate PR ?

Perhaps I understood the question wrong, but the instrumentation itself does not generate spans, only injects the active span context to log records. E.g. an example:

console.log(getSpanContext(context.active()));
logger.info('foobar');
logger.info('foobar', { something: 42 });

Without instrumentation:
image

With instrumentation:
image

@vmarchaud vmarchaud merged commit b128dae into open-telemetry:main Apr 19, 2021
@dyladan dyladan added the enhancement New feature or request label Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants