-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtracer.js
34 lines (20 loc) · 906 Bytes
/
tracer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const opentelemetry = require('@opentelemetry/api')
const { NodeTracerProvider } = require('@opentelemetry/node')
const { registerInstrumentations } = require('@opentelemetry/instrumentation')
const { ExpressInstrumentation } = require('@opentelemetry/instrumentation-express')
const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http')
const { JaegerExporter } = require('@opentelemetry/exporter-jaeger')
const { SimpleSpanProcessor } = require('@opentelemetry/tracing');
const traceProvider = new NodeTracerProvider()
exporter = new JaegerExporter({
host:'jaeger.linkerd-jaeger',
port:'14268'
})
traceProvider.addSpanProcessor(new SimpleSpanProcessor(exporter));
traceProvider.register()
registerInstrumentations({
instrumentations: [
new ExpressInstrumentation(),
new HttpInstrumentation({}),
]})
opentelemetry.trace.setGlobalTracerProvider(traceProvider)