File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
examples/tracer-web/examples/xml-http-request Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 11
22import { ConsoleSpanExporter , SimpleSpanProcessor } from '@opentelemetry/tracing' ;
3- import { WebTracer } from '@opentelemetry/web' ;
3+ import { WebTracerProvider } from '@opentelemetry/web' ;
44import { XMLHttpRequestPlugin } from '@opentelemetry/plugin-xml-http-request' ;
55import { ZoneScopeManager } from '@opentelemetry/scope-zone' ;
66import { CollectorExporter } from '@opentelemetry/exporter-collector' ;
77import { B3Format } from '@opentelemetry/core' ;
88
9- const webTracerWithZone = new WebTracer ( {
9+ const providerWithZone = new WebTracerProvider ( {
1010 httpTextFormat : new B3Format ( ) ,
1111 scopeManager : new ZoneScopeManager ( ) ,
1212 plugins : [
@@ -19,8 +19,10 @@ const webTracerWithZone = new WebTracer({
1919 ] ,
2020} ) ;
2121
22- webTracerWithZone . addSpanProcessor ( new SimpleSpanProcessor ( new ConsoleSpanExporter ( ) ) ) ;
23- webTracerWithZone . addSpanProcessor ( new SimpleSpanProcessor ( new CollectorExporter ( ) ) ) ;
22+ providerWithZone . addSpanProcessor ( new SimpleSpanProcessor ( new ConsoleSpanExporter ( ) ) ) ;
23+ providerWithZone . addSpanProcessor ( new SimpleSpanProcessor ( new CollectorExporter ( ) ) ) ;
24+
25+ const webTracerWithZone = providerWithZone . getTracer ( 'example-tracer-web' ) ;
2426
2527const getData = ( url ) => new Promise ( ( resolve , _reject ) => {
2628 // eslint-disable-next-line no-undef
You can’t perform that action at this time.
0 commit comments