diff --git a/examples/tracer-web/examples/xml-http-request/index.js b/examples/tracer-web/examples/xml-http-request/index.js index d6698223d6a..bf705d3d7fc 100644 --- a/examples/tracer-web/examples/xml-http-request/index.js +++ b/examples/tracer-web/examples/xml-http-request/index.js @@ -1,12 +1,12 @@ import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing'; -import { WebTracer } from '@opentelemetry/web'; +import { WebTracerProvider } from '@opentelemetry/web'; import { XMLHttpRequestPlugin } from '@opentelemetry/plugin-xml-http-request'; import { ZoneScopeManager } from '@opentelemetry/scope-zone'; import { CollectorExporter } from '@opentelemetry/exporter-collector'; import { B3Format } from '@opentelemetry/core'; -const webTracerWithZone = new WebTracer({ +const providerWithZone = new WebTracerProvider({ httpTextFormat: new B3Format(), scopeManager: new ZoneScopeManager(), plugins: [ @@ -19,8 +19,10 @@ const webTracerWithZone = new WebTracer({ ], }); -webTracerWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); -webTracerWithZone.addSpanProcessor(new SimpleSpanProcessor(new CollectorExporter())); +providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); +providerWithZone.addSpanProcessor(new SimpleSpanProcessor(new CollectorExporter())); + +const webTracerWithZone = providerWithZone.getTracer('example-tracer-web'); const getData = (url) => new Promise((resolve, _reject) => { // eslint-disable-next-line no-undef