Docs
SDK reference
classes
Spanimpl

Class: SpanImpl

Primary implementation of the Span interface. See the Span interface for full details on each method.

We suggest using one of the various startSpan methods, instead of creating Spans directly. See Span.startSpan for full details.

Implements

Constructors

constructor

new SpanImpl(args)

Parameters

NameType
argsObject

Methods

close

close(args?): number

Alias for end.

Parameters

NameType
args?EndSpanArgs

Returns

number

Implementation of

Span.close


end

end(args?): number

Terminate the span. Returns the end time logged to the row's metrics. After calling end, you may not invoke any further methods on the span object, except for the property accessors.

Will be invoked automatically if the span is constructed with traced.

Parameters

NameType
args?EndSpanArgs

Returns

number

The end time logged to the span metrics.

Implementation of

Span.end


log

log(event): void

Incrementally update the current span with new data. The event will be batched and uploaded behind the scenes.

Parameters

NameType
eventExperimentLogPartialArgs

Returns

void

Implementation of

Span.log


startSpan

startSpan(name, args?): Span

Create a new span. This is useful if you want to log more detailed trace information beyond the scope of a single log event. Data logged over several calls to Span.log will be merged into one logical row.

We recommend running spans within a callback (using traced) to automatically mark them as current and ensure they are terminated. If you wish to start a span outside a callback, be sure to terminate it with span.end().

Parameters

NameTypeDescription
namestringThe name of the span.
args?StartSpanArgs-

Returns

Span

The newly-created Span

Implementation of

Span.startSpan


traced

traced<R>(name, callback, args?): R

Wrapper over Span.startSpan, which passes the initialized Span it to the given callback and ends it afterwards. See Span.startSpan for full details.

Type parameters

Name
R

Parameters

NameType
namestring
callback(span: Span) => R
args?StartSpanArgs & SetCurrentArg

Returns

R

Implementation of

Span.traced

Properties

id

id: string

Row ID of the span.

Implementation of

Span.id


kind

kind: "span"

Implementation of

Span.kind


root_span_id

root_span_id: string

Span ID of the root span in the full trace.

Implementation of

Span.root_span_id


span_id

span_id: string

Span ID of the span. This is used to link spans together.

Implementation of

Span.span_id