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

Detect if we are in onceWrapper #3132

Closed
wants to merge 4 commits into from

Conversation

dyladan
Copy link
Member

@dyladan dyladan commented Aug 1, 2022

Fixes #2971

This is an alternative solution to #3123 and #3122

@dyladan dyladan requested a review from a team August 1, 2022 12:50
@codecov
Copy link

codecov bot commented Aug 1, 2022

Codecov Report

Merging #3132 (7988e65) into main (b1c0062) will decrease coverage by 0.39%.
The diff coverage is 100.00%.

❗ Current head 7988e65 differs from pull request most recent head c769909. Consider uploading reports for the commit c769909 to get more accurate results

@@            Coverage Diff             @@
##             main    #3132      +/-   ##
==========================================
- Coverage   93.10%   92.71%   -0.40%     
==========================================
  Files         196      181      -15     
  Lines        6400     5671     -729     
  Branches     1349     1204     -145     
==========================================
- Hits         5959     5258     -701     
+ Misses        441      413      -28     
Impacted Files Coverage Δ
...sync-hooks/src/AbstractAsyncHooksContextManager.ts 97.29% <100.00%> (+0.28%) ⬆️
packages/opentelemetry-resources/karma.worker.js 0.00% <0.00%> (-100.00%) ⬇️
...kages/opentelemetry-sdk-trace-base/karma.worker.js 0.00% <0.00%> (-100.00%) ⬇️
...lemetry-resources/src/detectors/BrowserDetector.ts 53.33% <0.00%> (-46.67%) ⬇️
...lemetry-resources/src/detectors/ProcessDetector.ts 95.45% <0.00%> (-4.55%) ⬇️
packages/opentelemetry-sdk-trace-web/src/types.ts
...-instrumentation-fetch/src/enums/AttributeNames.ts
...ntelemetry-resources/src/detectors/NoopDetector.ts
...s/opentelemetry-instrumentation-fetch/src/fetch.ts
...mentation-xml-http-request/src/enums/EventNames.ts
... and 11 more

@dyladan dyladan changed the title Add failing tests for #2971 Detect if we are in onceWrapper Aug 1, 2022
context: Context
) {
const contextManager = this;
return function (this: never, event: string, listener: Func<void>) {
let active = contextManager.active();
Copy link
Member

@Flarna Flarna Aug 1, 2022

Choose a reason for hiding this comment

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

Why do you use the active context manager here instead self?

Why do you set a property on context instead within the ContextManager instance?

Copy link
Member Author

Choose a reason for hiding this comment

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

I made a new version already I'm closing this

Copy link
Member Author

Choose a reason for hiding this comment

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

@dyladan dyladan closed this Aug 1, 2022
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.

AbstractAsyncHooksContextManager breaks .removeListener for handlers which was added with .once
2 participants