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

fix: prefer globalThis instead of window to support webworkers #2465

Merged
merged 7 commits into from
Oct 21, 2021

Conversation

legendecas
Copy link
Member

@legendecas legendecas commented Sep 9, 2021

Which problem is this PR solving?

  • Loading package @opentelemetry/core in WebWorkers or ServiceWorkers encountered `ReferenceError: window is not defined.
  • There is no window in either WebWorkers and ServiceWorkers.

Short description of the changes

@legendecas legendecas requested a review from a team September 9, 2021 09:17
There is no `window` in either WebWorkers and ServiceWorkers.
@codecov
Copy link

codecov bot commented Sep 9, 2021

Codecov Report

Merging #2465 (f713eb9) into main (9df2132) will increase coverage by 0.24%.
The diff coverage is 100.00%.

❗ Current head f713eb9 differs from pull request most recent head 5d78863. Consider uploading reports for the commit 5d78863 to get more accurate results

@@            Coverage Diff             @@
##             main    #2465      +/-   ##
==========================================
+ Coverage   92.69%   92.93%   +0.24%     
==========================================
  Files         129      135       +6     
  Lines        4503     4941     +438     
  Branches      973     1059      +86     
==========================================
+ Hits         4174     4592     +418     
- Misses        329      349      +20     
Impacted Files Coverage Δ
...opentelemetry-core/src/platform/node/globalThis.ts 100.00% <100.00%> (ø)
...-sdk-trace-web/src/enums/PerformanceTimingNames.ts
...telemetry-sdk-trace-web/src/StackContextManager.ts
packages/opentelemetry-sdk-trace-web/src/types.ts
packages/opentelemetry-sdk-trace-web/src/utils.ts
...entelemetry-sdk-trace-web/src/WebTracerProvider.ts
.../opentelemetry-exporter-otlp-http/src/transform.ts 88.69% <0.00%> (ø)
...s/opentelemetry-instrumentation-fetch/src/fetch.ts 96.98% <0.00%> (ø)
...lemetry-exporter-otlp-http/src/transformMetrics.ts 95.71% <0.00%> (ø)
...kages/opentelemetry-exporter-otlp-http/src/util.ts 100.00% <0.00%> (ø)
... and 6 more

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

@dyladan dyladan added the enhancement New feature or request label Sep 15, 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.

getEnv() for platform "browser" does not work with service workers
8 participants