Skip to content

Commit

Permalink
fix: update web examples to use WebTracerRegistry (open-telemetry#761)
Browse files Browse the repository at this point in the history
* fix: update web examples to use WebTracerRegistry

closes open-telemetry#756

* fix: renamed WebTracerRegistry to WebTracerProvider
  • Loading branch information
Ema93sh authored Feb 5, 2020
1 parent c5bc438 commit 26a1eac
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions examples/tracer-web/examples/xml-http-request/index.js
Original file line number Diff line number Diff line change
@@ -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: [
Expand All @@ -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
Expand Down

0 comments on commit 26a1eac

Please sign in to comment.