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: use a symbol to store patched listeners #1356

Merged
merged 8 commits into from
Aug 12, 2020

Conversation

Flarna
Copy link
Member

@Flarna Flarna commented Jul 27, 2020

Which problem is this PR solving?

There might be several instances of AsyncHooksContextManager present which would result in clashes.

Short description of the changes

Use a symbol instead a string property to avoid clashes in case several independent instances of AsyncHooksContextManager are present.

Use a symbol instead a string property to avoid clashes in case several independent
instances of AsyncHooksContextManager are present.
@codecov
Copy link

codecov bot commented Jul 27, 2020

Codecov Report

Merging #1356 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1356      +/-   ##
==========================================
+ Coverage   94.11%   94.13%   +0.01%     
==========================================
  Files         145      145              
  Lines        4318     4314       -4     
  Branches      880      877       -3     
==========================================
- Hits         4064     4061       -3     
+ Misses        254      253       -1     
Impacted Files Coverage Δ
...sync-hooks/src/AbstractAsyncHooksContextManager.ts 98.11% <100.00%> (+1.62%) ⬆️

Copy link
Member

@dyladan dyladan left a comment

Choose a reason for hiding this comment

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

change seems fine, and preventing these clashes is always a good thing, but what is the use-case for multiple context managers in a single project?

@Flarna
Copy link
Member Author

Flarna commented Jul 28, 2020

I don't think that this is a real usecase someone plans but it can just happen.
I have seen production environments with several APMs inside. All of them tend to have a context manager.

Consider a setup like dev team is using OTel and Operations adds an APM. The APM vendor may have a copy of OTel included.

There is also a possibility that someone just uses/forks the context manager from OTel to create something completely new.

In short, bigger nodejs applications sometimes tend to accumulate a lot stuff together...

Copy link
Member

@mwear mwear left a comment

Choose a reason for hiding this comment

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

LGTM

@dyladan dyladan added the enhancement New feature or request label Aug 12, 2020
@dyladan dyladan merged commit bdc4c94 into open-telemetry:master Aug 12, 2020
@dyladan dyladan deleted the use-symbol branch August 12, 2020 16:03
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.

5 participants