Maxim Logo
How toLog your application

Use spans to group units of work

Spans help you organize and track requests across microservices within traces. A trace represents the entire journey of a request through your system, while spans are smaller units of work within that trace.

Create spans with trace object

// Create a new trace instance with a unique identifier for request tracking
const trace = logger.trace({id: "trace-id"});
 
// Define a new span to track the question classification process
const span = trace.span({
    id: "span-id",
    name: "customer-support--classify-question",
});
 
// Note: Replace 'trace.span' with 'span.span' when creating spans within an existing span

Create spans with logger object

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

On this page