0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-12 07:07:43 -04:00
deno/tests/specs/cli/otel_basic/start_active_span.ts
Luca Casonato aa55efaa13
fix(otel): don't throw when calling setActiveSpan at root (#28323)
When calling `setActiveSpan` at the module root, or with `options.root =
true`, the function would internally throw.
2025-02-27 18:47:09 +01:00

12 lines
314 B
TypeScript

// Copyright 2018-2025 the Deno authors. MIT license.
import { trace } from "npm:@opentelemetry/api@1.9.0";
const tracer = trace.getTracer("example-tracer");
tracer.startActiveSpan("top level span", (span) => {
span.end();
});
tracer.startActiveSpan("root span", { root: true }, (span) => {
span.end();
});