Skip to content

Commit 889c926

Browse files
committed
refactor(tracing): discontinue use of deprecated APIs
1 parent c2aa0c4 commit 889c926

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

assets/js/tracing.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { getWebAutoInstrumentations } from '@opentelemetry/auto-instrumentations
77
import { registerInstrumentations } from '@opentelemetry/instrumentation';
88
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
99
import { Resource } from '@opentelemetry/resources';
10-
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
10+
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
1111
import { ZoneContextManager } from '@opentelemetry/context-zone-peer-dep';
1212

1313
const collectorOptions = {
@@ -16,21 +16,23 @@ const collectorOptions = {
1616
const exporter = new OTLPTraceExporter(collectorOptions);
1717

1818
const resources = new Resource({
19-
[SemanticResourceAttributes.SERVICE_NAME]: 'opentelemetry.io',
19+
[ATTR_SERVICE_NAME]: 'opentelemetry.io',
2020
'browser.language': navigator.language,
2121
});
2222

2323
const provider = new WebTracerProvider({
2424
resource: resources,
25+
spanProcessors: [
26+
new SimpleSpanProcessor(exporter),
27+
new SimpleSpanProcessor(new ConsoleSpanExporter()),
28+
],
2529
});
2630

2731
registerInstrumentations({
2832
instrumentations: [getWebAutoInstrumentations({})],
2933
tracerProvider: provider,
3034
});
3135

32-
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
33-
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
3436
provider.register({
3537
contextManger: new ZoneContextManager(),
3638
});

0 commit comments

Comments
 (0)