-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of OpenTelemetry are you using?
0.11.0
What version of Node are you using?
v12.18.3
Please provide the code you used to setup the OpenTelemetry SDK
CodeSandbox editor url https://codesandbox.io/s/dark-brook-q5dmi?fontsize=14&hidenavigation=1&theme=dark
CodeSandbox preview https://q5dmi.sse.codesandbox.io/
// JS code running inside web worker
import {
ConsoleSpanExporter,
SimpleSpanProcessor
} from "@opentelemetry/tracing";
import { WebTracerProvider } from "@opentelemetry/web";
const provider = new WebTracerProvider();
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
provider.register();What did you do?
Just load the page
What did you expect to see?
WebWorker would run successfully with opentelemetry instrumentation
What did you see instead?
Errors when running opentelemetry libs
Additional context
Some of the modules in opentelemetry use modules unavailable in web workers. So far I found these places
| const _window = window as typeof window & ENVIRONMENT_MAP; |
this code uses
window unavailable in web workers, it's simple to fix by replacing window with self
| const urlNormalizingA = document.createElement('a'); |
document is not available in web workers, it's probably possible to use different logic for normalizing URLs eg, new URL or something elseMetadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working