Skip to main content

SpanCreationOptionsinterface

Properties (23)

Property Type Default Required Description
addContextToTrace⚓︎ boolean true x

Whether the filtering context will be added as span attributes to the span. See 'Filter'.

autoSetSuccessStatus⚓︎ boolean false x

Whether the span's status will be set to OK on completion, if it's still UNSET. See 'Filter'.

canBeRoot⚓︎ boolean true x

Whether the span will be able to start a new trace. If false, it will only be able to be added to an existing trace.

countMetric⚓︎ boolean false x

Whether the span will be counted in the insights_trace_count metric. See TracesSettings.countMetric.

countMetricOnDisabledSpans⚓︎ boolean false x

Whether the span will be counted in the insights_trace_count metric if disabled. See TracesSettings.countMetric.

disableNesting⚓︎ boolean x x

Forces the span to create a new trace.

disablePropagation⚓︎ boolean false x

Whether the span will not inject its propagation info into data transfer objects for span nesting across system boundaries.

durationMetric⚓︎ boolean false x

Whether the span will be counted in the insights_trace_duration metric. See TracesSettings.durationtMetric.

durationMetricOnDisabledSpans⚓︎ boolean false x

Whether the span will be counted in the insights_trace_count metric if disabled. See TracesSettings.durationMetric.

enabled⚓︎ boolean true x

Whether the span will be created or will be a no-op. See 'Filter'.

forceChildTracing⚓︎ boolean false x

If true, any child spans (including nested spans across sytem boundaries) will be forced to be traced, even if their span filter configuration is set to not enabled.

forceStatus⚓︎ SpanStatusCode x x

If set, will force the span to have this status code, regardless of anything set explicitly or any errors caught automatically.

level⚓︎ keyof typeof SpanVerbosity INFO x

Default span attribute verbosity level. See 'Filter'.

linkToParent⚓︎ boolean false x

If true, the span is linked to its parent instead of being parented to it: it starts a trace of its own, and carries an OTEL span link to the span that would have been its parent (the link has the attribute linkToParent: true, to tell it from other links). The connection is kept, without the span becoming part of the parent's trace - for a parent that is long-lived or unrelated in meaning, such as the application startup span that every span created during the startup window is nested under by default.

Applies wherever the parent comes from: an explicit propagation info, the current tracing state, or the default propagation info. The span's own children are nested under it as usual, in its new trace. Without a parent there is nothing to link, and the span is an ordinary root; the same goes for disableNesting, which leaves the span without a parent.

The parent still counts as a parent for canBeRoot (a span that cannot be a root is still created) and for the parent's forceChildTracing. Sampling is decided for the new trace on its own - the parent's sampling decision is not inherited.

log⚓︎ boolean | TracesAsLogsOptions false x

"Traces as logs": whether the span is also published as a log entry, using the traceLogger passed to the builder instance when building the Traces module. true logs the span when it is enabled; false turns the logging off altogether; a TracesAsLogsOptions object says what is logged in more detail.

The places the option can be set in - a matching filter, the span's own options, the defaults - are combined option by option: defaults: { log: { includeResourceAttributes: true } } with log: true in a filter logs that filter's spans with their resource attributes.

maxAttributeDepth⚓︎ number 5 x

How deep addData method should recurse into objects when adding attributes to spans.

minDurationMs⚓︎ number 0 x

If specified, spans whose duration is lower than this will not be sampled.

otelSpanOptions⚓︎ SpanOptions x x

OTEL span options

overrideDefaultFilters⚓︎ boolean false x

If true, this filter rule will be matched before any default filters provided by io.Connect. The default filters are usually meant to reduce verbosity by not tracing some internal operations by default, but you can use this property to force them to be traced. If false, default filters will be matched before this filtering rule.

resultMetric⚓︎ boolean false x

Whether the span will be counted in the insights_trace_result metric. See TracesSettings.resultMetric.

resultMetricOnDisabledSpans⚓︎ boolean false x

Whether the span will be counted in the insights_trace_result metric if disabled. See TracesSettings.resultMetric.

sample⚓︎ number | boolean true x

Default sampling setting/probability. See 'SamplingSettings'.

stopPropagationIfSpanIsDisabled⚓︎ boolean false x

If a tracing span is disabled by filter, setting this to "true" will stop the propagation of trace nesting info across it.