@@ -7,7 +7,7 @@ import { getWebAutoInstrumentations } from '@opentelemetry/auto-instrumentations
7
7
import { registerInstrumentations } from '@opentelemetry/instrumentation' ;
8
8
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http' ;
9
9
import { Resource } from '@opentelemetry/resources' ;
10
- import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions' ;
10
+ import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions' ;
11
11
import { ZoneContextManager } from '@opentelemetry/context-zone-peer-dep' ;
12
12
13
13
const collectorOptions = {
@@ -16,21 +16,23 @@ const collectorOptions = {
16
16
const exporter = new OTLPTraceExporter ( collectorOptions ) ;
17
17
18
18
const resources = new Resource ( {
19
- [ SemanticResourceAttributes . SERVICE_NAME ] : 'opentelemetry.io' ,
19
+ [ ATTR_SERVICE_NAME ] : 'opentelemetry.io' ,
20
20
'browser.language' : navigator . language ,
21
21
} ) ;
22
22
23
23
const provider = new WebTracerProvider ( {
24
24
resource : resources ,
25
+ spanProcessors : [
26
+ new SimpleSpanProcessor ( exporter ) ,
27
+ new SimpleSpanProcessor ( new ConsoleSpanExporter ( ) ) ,
28
+ ] ,
25
29
} ) ;
26
30
27
31
registerInstrumentations ( {
28
32
instrumentations : [ getWebAutoInstrumentations ( { } ) ] ,
29
33
tracerProvider : provider ,
30
34
} ) ;
31
35
32
- provider . addSpanProcessor ( new SimpleSpanProcessor ( exporter ) ) ;
33
- provider . addSpanProcessor ( new SimpleSpanProcessor ( new ConsoleSpanExporter ( ) ) ) ;
34
36
provider . register ( {
35
37
contextManger : new ZoneContextManager ( ) ,
36
38
} ) ;
0 commit comments