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

perf(opentelemetry-node): plugin loader search required cache #1807

Merged
merged 4 commits into from
Jan 12, 2021
Merged

perf(opentelemetry-node): plugin loader search required cache #1807

merged 4 commits into from
Jan 12, 2021

Conversation

blumamir
Copy link
Member

@blumamir blumamir commented Jan 11, 2021

Which problem is this PR solving?

Short description of the changes

  • in pluginLoader, check if plugins are already required by executing require.resolve once per plugin, and searching for the result in require.cache object in O(1) instead of looping on the entire keys array

@codecov
Copy link

codecov bot commented Jan 11, 2021

Codecov Report

Merging #1807 (58e63d5) into master (5862bc0) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1807      +/-   ##
==========================================
- Coverage   92.46%   92.46%   -0.01%     
==========================================
  Files         173      173              
  Lines        6014     6012       -2     
  Branches     1287     1287              
==========================================
- Hits         5561     5559       -2     
  Misses        453      453              
Impacted Files Coverage Δ
...trumentation/src/platform/node/old/PluginLoader.ts 93.90% <100.00%> (-0.08%) ⬇️
...telemetry-node/src/instrumentation/PluginLoader.ts 93.75% <100.00%> (-0.08%) ⬇️

@blumamir
Copy link
Member Author

I assume the failing test is due to #1799 (also not passing on master).
Will merge master into the branch once the issue is resolved to fix required checks.

Copy link
Member

@vmarchaud vmarchaud left a comment

Choose a reason for hiding this comment

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

Change need to be made in the instrumentation package too (sorry we are in the process of migrating the loader so there are redundant code)

@blumamir
Copy link
Member Author

Change need to be made in the instrumentation package too (sorry we are in the process of migrating the loader so there are redundant code)

@vmarchaud
thanks for pointing it out.
pushed an update

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.

lgtm, nice finding

@dyladan dyladan added the enhancement New feature or request label Jan 12, 2021
@dyladan dyladan merged commit 7db3d2a into open-telemetry:master Jan 12, 2021
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request Dec 15, 2023
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
4 participants