1

Initialize Spans with Trace Object

Create spans with trace object

const trace = logger.trace({id: "trace-id"});

const span = trace.span({
    id: "span-id",
    name: "customer-support--classify-question",
});

Replace ‘trace.span’ with ‘span.span’ when creating spans within an existing span

2

Alternative: Create Spans Using Logger Object

const span = logger.traceSpan("trace-id", {
    id: "span-id",
    name: "customer-support--classify-question",
});