# TracesSettings

**Kind**: interface | **Module**: [Insights](https://docs.interop.io/desktop/reference/javascript/insights/index.md)

**Source**: https://docs.interop.io/desktop/reference/javascript/insights/tracessettings/index.html

## Properties

- **`additionalAttributes`** (`{ [x: string]: unknown } | (() => { [x: string]: unknown })`, optional)
  Additional span attributes to publish as part of each span, specified as key/value pairs. You can use environment variables as values. Environment variables must start and end with a percent sign (e.g., `%MyEnvVar%`), and can contain a fallback value (e.g., `%MyEnvVar?literalDefaultValue%`).
- **`additionalResourceAttributes`** (`{ [x: string]: unknown } | (() => { [x: string]: unknown })`, optional)
  Additional attributes to publish as part of the OTEL resource definition, specified as key/value pairs. You can use environment variables as values. Environment variables must start and end with a percent sign (e.g., `%MyEnvVar%`), and can contain a fallback value (e.g., `%MyEnvVar?literalDefaultValue%`).
- **`addResourceAttributesToAttributes`** (`boolean`, optional) default: `false`
  Whether to add resource attributes to span attributes.
- **`clickstream`** (`boolean | "nested" | "sibling" | ClickstreamTraceConfig`, optional) default: `true`
  Whether the clickstream trace will be enabled.
  false - clickstream trace is disabled.
  true - same as sibling
  nested - clickstream trace is enabled and each subsequent span is a child span of the previous one.
  sibling - clickstream trace is enabled and each subsequent span is a child of the same initial span.
- **`closeTrace`** (`boolean`, optional) default: `false`
  If `true`, the application will create a span with the name `interopio.api.application.close` when
  it's being closed. This functionality requires close handlers to be enabled in the application
  configuration.
- **`compression`** (`CompressionAlgorithm`, optional)
  Compression algorithm to use when exporting trace.
- **`concurrencyLimit`** (`number`, optional)
  Maximum number of concurrent trace export requests.
- **`console`** (`boolean`, optional)
  If an OTEL TraceProvider isn't provided to the library,
  it will initialize its own.

  If 'console' is 'true', TracerProvider will
  have a ConsoleTraceExporter.
- **`contextManager`** (`(tracesSettings: IOInsights.TracesSettings, settings: IOInsights.Settings) => ContextManager`, optional)
  Allows specifying a constructor callback for creating the ContextManager instance.
- **`countMetric`** (`string`, optional) default: `insights_trace_count`
  Name of span hit counter metric, set to null to disable.
- **`defaultFilters`** (`SpanFilter[]`, optional)
  This property is for internal use only.
- **`defaults`** (`SpanCreationOptions`, optional)
  Default settings if appropriate entries aren't found
  in 'filters' and 'sampling' collections.
- **`durationMetric`** (`string`, optional) default: `insights_trace_duration`
  Name of span duration histogram metric, set to null to disable.
- **`enabled`** (`boolean`, required) default: `false`
  Whether tracing functionality is enabled.
  If disabled, API is still usable, but methods are no-ops.
- **`exporterSettings`** (`OTLPExporterNodeConfigBase`, optional)
  If an OTEL TraceProvider isn't provided to the library,
  it will initialize its own.

  If 'url' is specified, TracerProvider will
  have an OTLPTraceExporter with 'url' as detination URL and
  'exporterSettings' as additional config.
- **`filters`** (`SpanFilter[]`, optional)
  Array of filter entries used to determine whether
  a particular operation will create a tracing span, and
  what verbosity level will apply to attributes added
  to that span.

  If no matching filter entry is found,
  the settings from 'default' are used.
- **`headers`** (`{ [x: string]: string } | (() => { [x: string]: string })`, optional)
  Additional headers to send in HTTP requests, e.g. when using HTTP exporters.
- **`hybridContextMode`** (`boolean`, optional) default: `false`
  If `true`, the library will use both the ContextManager
  provided by the OTEL SDK and the `Traces.currentTracingState`
  property to resolve the current context. See the documentation
  of the `useOTELContextManager` property for more details.
- **`instrumentAppLoad`** (`boolean`, optional) default: `true`
  If `true`, io.Insights will instrument and trace the application loading process
  automatically.
- **`instrumentDocumentLoad`** (`boolean`, optional) default: `true`
  If `true`, io.Insights will instrument and trace the steps of the document load
  and initialization process automatically
- **`instrumentRequests`** (`boolean | RequestTraceConfig`, optional) default: `true`
  If `true`, io.Insights will instrument and trace XMLHttpRequest and fetch()
  requests automatically.
- **`keepAlive`** (`boolean`, optional) default: `true`
  Whether to keep the connection alive when sending traces.
- **`otlpExporterConfig`** (`OTLPExporterNodeConfigBase`, optional)
- **`parentNameLimit`** (`number`, optional)
  Maximum length for parent operation names in span hierarchies.
- **`processorSettings`** (`BatchSpanProcessorBrowserConfig`, optional)
  Configuration for the batch span processor buffer settings.
- **`propagator`** (`(tracesSettings: IOInsights.TracesSettings, settings: IOInsights.Settings) => TextMapPropagator`, optional)
  Allows specifying a constructor callback for creating the TextMapPropagator instance.
- **`publishInterval`** (`number`, optional)
  Interval in milliseconds between trace export batches.
- **`resultMetric`** (`string`, optional) default: `insights_trace_result`
  Name of span result counter metric, set to null to disable.
- **`rootPropagationInfo`** (`PropagationInfo`, optional)
  Property for internal use.
- **`sampler`** (`(defaultSampler: Sampler, tracesSettings: IOInsights.TracesSettings, settings: IOInsights.Settings) => Sampler`, optional)
  Allows specifying a constructor callback for creating the Sampler instance.
- **`sampling`** (`SamplingSettings[]`, optional)
  Array of sampling setting entries used to determine
  whether a span will be sampled.

  If no matching sampling setting entry is found,
  the settings from 'defaults' are used.
- **`spanExporters`** (`(exporterSettings: OTLPExporterNodeConfigBase, tracesSettings: IOInsights.TracesSettings, settings: IOInsights.Settings) => SpanExporter[]`, optional)
  Allows specifying a constructor callback for creating the SpanExporter instances.
- **`spanProcessors`** (`(processorSettings: BatchSpanProcessorBrowserConfig | undefined, exporterSettings: OTLPExporterNodeConfigBase, tracesSettings: IOInsights.TracesSettings, settings: IOInsights.Settings) => SpanProcessor[]`, optional)
  Allows specifying a constructor callback for creating the SpanProcessor instances.
- **`startupParentSpanTimeoutMs`** (`number`, optional) default: `3000`
  How long after application startup will any traced operations
  automatically be nested under the application startup trace.
- **`timeoutMillis`** (`number`, optional) default: `10000ms.`
  Maximum time the OTLP exporter will wait for each batch export.
- **`tracerProvider`** (`(tracerProviderSettings: TracerConfig, tracesSettings: IOInsights.TracesSettings, settings: IOInsights.Settings) => TracerProvider`, optional)
  Allows specifying a constructor callback for creating the tracerProvider instance.
- **`tracerProviderSettings`** (`TracerConfig`, optional)
  OTEL TracerConfig - provides an interface for configuring a Basic Tracer.
- **`url`** (`string`, optional)
  If an OTEL TraceProvider isn't provided to the library,
  it will initialize its own.

  If 'url' is specified, TracerProvider will
  have an OTLPTraceExporter using this destination URL.
- **`useDefaultFilters`** (`boolean`, optional) default: `true.`
  If true, use a predefined list of filters for well-known
  platform traces.
- **`useOTELContextManager`** (`boolean`, optional) default: `false`
  If `true`, the library will use the ContextManager provided
  by the active OTEL SDK to manage and derive propagation information
  to ensure spans created across asynchronous operations are properly
  nested.

  Otherwise, use `Traces.currentTracingState` to set and retrieve propagation
  info across asynchronous operations manually.

  See https://opentelemetry.io/docs/languages/js/propagation/ and
  https://opentelemetry.io/docs/languages/js/context/#context-manager for
  more information.
- **`userJourney`** (`boolean | "nested" | "sibling" | UserJourneyTraceConfig`, optional) default: `true`
  Whether the user journey trace will be enabled.
  false - User Journey trace is disabled.
  nested - User Journey trace is enabled and each subsequent span is a child span of the previous one.
  sibling - User Journey trace is enabled and each subsequent span is a child of the same initial span.

## Related types

- [ClickstreamTraceConfig](https://docs.interop.io/desktop/reference/javascript/insights/clickstreamtraceconfig/index.md)
- [PropagationInfo](https://docs.interop.io/desktop/reference/javascript/insights/propagationinfo/index.md)
- [RequestTraceConfig](https://docs.interop.io/desktop/reference/javascript/insights/requesttraceconfig/index.md)
- [SamplingSettings](https://docs.interop.io/desktop/reference/javascript/insights/samplingsettings/index.md)
- [Settings](https://docs.interop.io/desktop/reference/javascript/insights/settings/index.md)
- [SpanCreationOptions](https://docs.interop.io/desktop/reference/javascript/insights/spancreationoptions/index.md)
- [SpanFilter](https://docs.interop.io/desktop/reference/javascript/insights/spanfilter/index.md)
- [UserJourneyTraceConfig](https://docs.interop.io/desktop/reference/javascript/insights/userjourneytraceconfig/index.md)
