-
Notifications
You must be signed in to change notification settings - Fork 2
/
tracing.js
42 lines (30 loc) · 1.11 KB
/
tracing.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
35
36
37
38
39
40
41
42
const { GrpcInstrumentation } = require("@opentelemetry/instrumentation-grpc");
const grpcInstrumentation = new GrpcInstrumentation();
const { HttpInstrumentation } = require("@opentelemetry/instrumentation-http");
const {
SentrySpanProcessor,
SentryPropagator,
} = require("@sentry/opentelemetry-node");
const { diag, DiagConsoleLogger, DiagLogLevel } = require("@opentelemetry/api");
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ALL);
const opentelemetry = require("@opentelemetry/sdk-node");
// const { ConsoleSpanExporter } = require("@opentelemetry/sdk-trace-node");
const {
OTLPTraceExporter,
} = require("@opentelemetry/exporter-trace-otlp-grpc");
const {
ExpressInstrumentation,
} = require("@opentelemetry/instrumentation-express");
const sdk = new opentelemetry.NodeSDK({
traceExporter: new OTLPTraceExporter(),
//traceExporter: new ConsoleSpanExporter(),
instrumentations: [
grpcInstrumentation,
new HttpInstrumentation(),
new ExpressInstrumentation(),
],
// Sentry config
spanProcessor: new SentrySpanProcessor(),
textMapPropagator: new SentryPropagator(),
});
sdk.start();