34 lines
1001 B
JavaScript
34 lines
1001 B
JavaScript
"use strict";
|
|
|
|
const { NodeTracerProvider } = require("@opentelemetry/node");
|
|
const { SimpleSpanProcessor } = require("@opentelemetry/tracing");
|
|
const { ZipkinExporter } = require("@opentelemetry/exporter-zipkin");
|
|
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
|
|
const { ExpressInstrumentation } = require('@opentelemetry/instrumentation-express');
|
|
const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http');
|
|
|
|
const provider = new NodeTracerProvider();
|
|
|
|
provider.addSpanProcessor(
|
|
new SimpleSpanProcessor(
|
|
new ZipkinExporter({
|
|
serviceName: "getting-started"
|
|
// If you are running your tracing backend on another host,
|
|
// you can point to it using the `url` parameter of the
|
|
// exporter config.
|
|
})
|
|
)
|
|
);
|
|
|
|
provider.register();
|
|
|
|
// load old default plugins
|
|
registerInstrumentations({
|
|
instrumentations: [
|
|
new ExpressInstrumentation(),
|
|
new HttpInstrumentation(),
|
|
],
|
|
});
|
|
|
|
console.log("tracing initialized");
|