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(instrumentation-fs): require parent span #1335

Merged
merged 2 commits into from
Jan 16, 2023

Conversation

unflxw
Copy link
Contributor

@unflxw unflxw commented Dec 27, 2022

Which problem is this PR solving?

  • The fs instrumentation, unlike other instrumentations, does not have a requireParentSpan option, in order to only trace calls to the fs module that happen in the context of a broader action. Applications might, for example, read some files during boot, which would rarely make for useful traces.

Short description of the changes

  • Add a requireParentSpan option, which defaults to false. If set to true, calls to the fs module will not be instrumented unless the current active context has a span, so the fs instrumentation will never create a trace of its own.

@codecov
Copy link

codecov bot commented Dec 27, 2022

Codecov Report

Merging #1335 (6c8e038) into main (04d583b) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1335   +/-   ##
=======================================
  Coverage   96.08%   96.08%           
=======================================
  Files          14       14           
  Lines         893      893           
  Branches      191      191           
=======================================
  Hits          858      858           
  Misses         35       35           

Copy link
Member

@blumamir blumamir left a comment

Choose a reason for hiding this comment

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

Thanks for working on this
I added a few comments about code style. They are all non-blocker and optional, so feel free to resolve them if you think otherwise.

plugins/node/instrumentation-fs/src/instrumentation.ts Outdated Show resolved Hide resolved
plugins/node/instrumentation-fs/src/instrumentation.ts Outdated Show resolved Hide resolved
plugins/node/instrumentation-fs/test/parent.test.ts Outdated Show resolved Hide resolved
plugins/node/instrumentation-fs/test/parent.test.ts Outdated Show resolved Hide resolved
plugins/node/instrumentation-fs/test/parent.test.ts Outdated Show resolved Hide resolved
plugins/node/instrumentation-fs/test/parent.test.ts Outdated Show resolved Hide resolved
plugins/node/instrumentation-fs/test/parent.test.ts Outdated Show resolved Hide resolved
@unflxw
Copy link
Contributor Author

unflxw commented Jan 1, 2023

Thank you for the comments @blumamir! They make a lot of sense to me -- the naming around the test generator function is very wonky. I'll address these the coming week.

@unflxw unflxw force-pushed the fs-require-parent-span branch from 70c2dd9 to 11632bc Compare January 10, 2023 16:53
@unflxw
Copy link
Contributor Author

unflxw commented Jan 10, 2023

Done. Feel free to merge if the tests pass 🚀

EDIT: not sure why the tests don't pass -- the linter seems to be unhappy about a file that isn't changed by this PR?

@blumamir blumamir merged commit 79b2d3f into open-telemetry:main Jan 16, 2023
@dyladan dyladan mentioned this pull request Jan 16, 2023
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

Successfully merging this pull request may close these issues.

3 participants