-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtracing.js
More file actions
26 lines (24 loc) · 1.37 KB
/
Copy pathtracing.js
File metadata and controls
26 lines (24 loc) · 1.37 KB
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
// Configure your .env with Honeycomb specific variables. See .env.sample.
require("dotenv").config();
const { getNodeAutoInstrumentations } = require("@opentelemetry/auto-instrumentations-node");
const { Metadata, credentials } = require("@grpc/grpc-js");
const { NodeSDK } = require("@opentelemetry/sdk-node");
// const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http');
const { ExpressInstrumentation } = require("@opentelemetry/instrumentation-express");
//const {OTLPTraceExporter} = require("@opentelemetry/exporter-trace-otlp-proto");
const { OTLPTraceExporter } = require("@opentelemetry/exporter-trace-otlp-grpc");
// const { OTLPTraceExporter } = require("@opentelemetry/exporter-collector-grpc");
const { diag } = require("@opentelemetry/api");
const { DiagConsoleLogger } = require("@opentelemetry/api");
const { DiagLogLevel } = require("@opentelemetry/api");
const { BatchSpanProcessor } = require("@opentelemetry/sdk-trace-base");
const { EventLoopProcessor } = require("./EventLoopProcessor");
const { trace } = require("@grpc/grpc-js/build/src/logging");
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);
const traceExporter = new OTLPTraceExporter();
const sdk = new NodeSDK({
traceExporter,
instrumentations: [getNodeAutoInstrumentations()],
spanProcessor: new EventLoopProcessor(new BatchSpanProcessor(traceExporter)),
});
sdk.start();