Skip to main content
Access via:io.insights.traces

Traces API.

Properties (6)

Property Type Default Required Description
clickstreamMarker⚓︎ MarkerSpanCallback x x

Optional callback function to programmatically create marker spans in the Clickstream trace. Allows applications to mark specific user interaction events beyond automatic click tracking (e.g., custom UI interactions, gesture events, programmatic actions).

The callback receives:

  • source: A descriptive name for the marker (e.g., "user-swiped-left", "custom-button-action")
  • data: Optional span data organized by verbosity level for detailed context

Returns either PropagationInfo to link the marker span to other traces, or void.

Works in conjunction with the clickstream setting to track detailed user interaction patterns.

currentTracingState⚓︎ TracingState | null x

The tracing state representing the currently active trace and span, if any.

settings⚓︎ TracesSettings x

Traces settings.

started⚓︎ boolean x

Whether or not this instance is started.

startupTraceFinished⚓︎ () => void x x

Called by the application to signify that its startup has completed and no further spans should be nested under the startup trace.

userJourneyMarker⚓︎ MarkerSpanCallback x x

Optional callback function to programmatically create marker spans in the User Journey trace. Allows applications to mark significant points in a user's journey through the application (e.g., navigation events, key user actions, milestone completions).

The callback receives:

  • source: A descriptive name for the marker (e.g., "user-navigated-to-dashboard")
  • data: Optional span data organized by verbosity level for detailed context

Returns either PropagationInfo to link the marker span to other traces, or void.

Works in conjunction with the userJourney setting to track the user's entire session flow.

14 Methods

setFilterConfig()⚓︎

(filters: SpanFilter[]) => void

Allows updating the configured filters.

Parameters (1)

Name Type Required Description
filters⚓︎ SpanFilter[] x

start()⚓︎

() => Promise<void>

Starts publishing data.

stop()⚓︎

() => Promise<void>

Stops publishing data.

waitForFinalExport()⚓︎

(timeoutMs?: number) => Promise<void>

Waits for any pending data to be published, with the option to specify a timeout.

Parameters (1)

Name Type Required Description
timeoutMs⚓︎ number x

maximum time to wait for export

withSequenceSpan()⚓︎

<T>(source: string, callback: | WithSpanCallback<T>) => Promise<T>

Allows creating a span for a named trace.

Parameters (2)

Name Type Required Description
source⚓︎ string

The name of the span to create. The name of the trace will be .start, and if one doesn't exist, it will be created.

callback⚓︎ | WithSpanCallback<T>

Logic to execute in the span.

withSequenceSpan()⚓︎

<T>(source: string, filteringContext: | FilteringContext | null, callback: | WithSpanCallback<T>) => Promise<T>

Allows creating a span for a named trace.

Parameters (3)

Name Type Required Description
source⚓︎ string

The name of the span to create. The name of the trace will be .start, and if one doesn't exist, it will be created.

filteringContext⚓︎ | FilteringContext | null

Filtering context used to match against the tracing filtering configuration.

callback⚓︎ | WithSpanCallback<T>

Logic to execute in the span.

withSequenceSpan()⚓︎

<T>(source: string, filteringContext: | FilteringContext | null, options: | WithSpanOptions | null, callback: | WithSpanCallback<T>) => Promise<T>

Allows creating a span for a named trace.

Parameters (4)

Name Type Required Description
source⚓︎ string

The name of the span to create. The name of the trace will be .start, and if one doesn't exist, it will be created.

filteringContext⚓︎ | FilteringContext | null

Filtering context used to match against the tracing filtering configuration.

options⚓︎ | WithSpanOptions | null

Options to use when creating the span.

callback⚓︎ | WithSpanCallback<T>

Logic to execute in the span.

withSequenceSpanEx()⚓︎

<T>(source: string, traceName: | string | null, callback: | WithSpanCallback<T>) => Promise<T>

Allows creating a span for a named trace.

Parameters (3)

Name Type Required Description
source⚓︎ string

The name of the span to create.

traceName⚓︎ | string | null

The name of the trace to nest the span in. If one doesn't exist, it will be created.

callback⚓︎ | WithSpanCallback<T>

Logic to execute in the span.

withSequenceSpanEx()⚓︎

<T>(source: string, traceName: | string | null, filteringContext: | FilteringContext | null, callback: | WithSpanCallback<T>) => Promise<T>

Allows creating a span for a named trace.

Parameters (4)

Name Type Required Description
source⚓︎ string

The name of the span to create.

traceName⚓︎ | string | null

The name of the trace to nest the span in. If one doesn't exist, it will be created.

filteringContext⚓︎ | FilteringContext | null

Filtering context used to match against the tracing filtering configuration.

callback⚓︎ | WithSpanCallback<T>

Logic to execute in the span.

withSequenceSpanEx()⚓︎

<T>(source: string, traceName: | string | null, filteringContext: | FilteringContext | null, options: | WithSpanOptions | null, callback: | WithSpanCallback<T>) => Promise<T>

Allows creating a span for a named trace.

Parameters (5)

Name Type Required Description
source⚓︎ string

The name of the span to create.

traceName⚓︎ | string | null

The name of the trace to nest the span in. If one doesn't exist, it will be created.

filteringContext⚓︎ | FilteringContext | null

Filtering context used to match against the tracing filtering configuration.

options⚓︎ | WithSpanOptions | null

Options to use when creating the span.

callback⚓︎ | WithSpanCallback<T>

Logic to execute in the span.

withSpan()⚓︎

<T>(source: string, callback: WithSpanCallback<T>) => T

Allows creating a span for the currently active trace. If one doesn't exist, it will be created.

Parameters (2)

Name Type Required Description
source⚓︎ string

The name of the span to create.

callback⚓︎ WithSpanCallback<T>

Logic to execute in the span.

withSpan()⚓︎

<T>(source: string, filteringContext: FilteringContext, callback: WithSpanCallback<T>) => T

Allows creating a span for the currently active trace. If one doesn't exist, it will be created.

Parameters (3)

Name Type Required Description
source⚓︎ string

The name of the span to create.

filteringContext⚓︎ FilteringContext

Filtering context used to match against the tracing filtering configuration.

callback⚓︎ WithSpanCallback<T>

Logic to execute in the span.

withSpan()⚓︎

<T>(source: string, filteringContext: FilteringContext, propagationInfo: PropagationInfo | PropagationInfoCarrier | null, callback: WithSpanCallback<T>) => T

Allows creating a span for the currently active trace or a specified trace. If one doesn't exist, it will be created.

Parameters (4)

Name Type Required Description
source⚓︎ string

The name of the span to create.

filteringContext⚓︎ FilteringContext

Filtering context used to match against the tracing filtering configuration.

propagationInfo⚓︎ PropagationInfo | PropagationInfoCarrier | null

Span and trace id to use for manually nesting the new trace.

callback⚓︎ WithSpanCallback<T>

Logic to execute in the span.

withSpan()⚓︎

<T>(source: string, filteringContext: FilteringContext, propagationInfo: PropagationInfo | PropagationInfoCarrier | null, options: WithSpanOptions | null, callback: WithSpanCallback<T>) => T

Allows creating a span for the currently active trace or a specified trace. If one doesn't exist, it will be created.

Parameters (5)

Name Type Required Description
source⚓︎ string

The name of the span to create.

filteringContext⚓︎ FilteringContext

Filtering context used to match against the tracing filtering configuration.

propagationInfo⚓︎ PropagationInfo | PropagationInfoCarrier | null

Span and trace id to use for manually nesting the new trace.

options⚓︎ WithSpanOptions | null

Options to use when creating the span.

callback⚓︎ WithSpanCallback<T>

Logic to execute in the span.