Skip to main content
Module

x/live/deps.ts>Span

Open-Source web editor based on Preact, Tailwind and TypeScript. The other side of code.
Very Popular
Go to Latest
interface Span
import { type Span } from "https://deno.land/x/live@1.48.5/deps.ts";

An interface that represents a span. A span represents a single operation within a trace. Examples of span might include remote procedure calls or a in-process function calls to sub-components. A Trace has a single, top-level "root" Span that in turn may have zero or more child Spans, which in turn may have children.

Spans are created by the Tracer.startSpan method.

Properties

start: number
end: number
ctxt: number

Methods

spanContext(): SpanContext

Returns the SpanContext object associated with this Span.

Get an immutable, serializable identifier for this span that can be used to create new child spans. Returned SpanContext is usable even after the span ends.

setAttribute(key: string, value: SpanAttributeValue): this

Sets an attribute to the span.

Sets a single Attribute with the key and value passed as arguments.

setAttributes(attributes: SpanAttributes): this

Sets attributes to the span.

addEvent(
name: string,
attributesOrStartTime?: SpanAttributes | TimeInput,
startTime?: TimeInput,
): this

Adds an event to the Span.

setStatus(status: SpanStatus): this

Sets a status to the span. If used, this will override the default Span status. Default is SpanStatusCode.UNSET. SetStatus overrides the value of previous calls to SetStatus on the Span.

updateName(name: string): this

Updates the Span name.

This will override the name provided via Tracer.startSpan.

Upon this update, any sampling behavior based on Span name will depend on the implementation.

end(endTime?: TimeInput): void

Marks the end of Span execution.

Call to End of a Span MUST not have any effects on child spans. Those may still be running and can be ended later.

Do not return this. The Span generally should not be used after it is ended so chaining is not desired in this context.

isRecording(): boolean

Returns the flag whether this span will be recorded.

recordException(exception: Exception, time?: TimeInput): void

Sets exception as a span event