A span represents a single operation within a trace.
setAttribute(key: string,value: SpanAttributeValue): this
Sets a single attribute on the span.
setAttributes(attributes: Readonly<Record<string, SpanAttributeValue>>): this
Sets multiple attributes on the span.
setStatus(status: SpanStatus): void
Sets the status of the span.
recordException(error: Error): void
Records an exception on this span.
end(): void
Ends the span. Must be called exactly once.
Since 0.2.0
spanContext(): SpanContext
Returns the span's context (traceId, spanId, traceFlags).
Used by the middleware to inject the span's own traceparent into the
response header so downstream hops see this server span as the parent.