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
Name | Type |
---|---|
args | Object |
Methods
close
▸ close(args?
): number
Alias for end
.
Parameters
Name | Type |
---|---|
args? | EndSpanArgs |
Returns
number
Implementation of
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
Name | Type |
---|---|
args? | EndSpanArgs |
Returns
number
The end time logged to the span metrics.
Implementation of
log
▸ log(event
): void
Incrementally update the current span with new data. The event will be batched and uploaded behind the scenes.
Parameters
Name | Type |
---|---|
event | ExperimentLogPartialArgs |
Returns
void
Implementation of
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
Name | Type | Description |
---|---|---|
name | string | The name of the span. |
args? | StartSpanArgs | - |
Returns
The newly-created Span
Implementation of
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
Name | Type |
---|---|
name | string |
callback | (span : Span ) => R |
args? | StartSpanArgs & SetCurrentArg |
Returns
R
Implementation of
Properties
id
• id: string
Row ID of the span.
Implementation of
kind
• kind: "span"
Implementation of
root_span_id
• root_span_id: string
Span ID of the root span in the full trace.
Implementation of
span_id
• span_id: string
Span ID of the span. This is used to link spans together.