Closed
Description
I followed the very simple instrumentation instructions:
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http');
const { ExpressInstrumentation } = require('@opentelemetry/instrumentation-express');
const provider = new NodeTracerProvider();
provider.register();
registerInstrumentations({
instrumentations: [
// Express instrumentation expects HTTP layer to be instrumented
new HttpInstrumentation(),
new ExpressInstrumentation(),
],
});
And in my express code I am trying to get the active span:
app.get("/api/results/:id", async (req, res) => {
const localSpan = opentelemetry.trace.getActiveSpan();
But it ends up being null??