# Insights.Config

**Kind**: interface | **Module**: [io.Connect Browser](https://docs.interop.io/browser/reference/javascript/io.connect%20browser/index.md)

**Source**: https://docs.interop.io/browser/reference/javascript/io.connect browser/insights.config/index.html

Configuration for publishing io.Insights data.

## Properties

- **`additionalAttributes`** (`{ [x: string]: unknown; } | (() => { [x: string]: unknown; })`, optional)
  Additional properties to publish as part of each OpenTelemetry signal, 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?DefaultValue%`).
- **`additionalResourceAttributes`** (`{ [x: string]: unknown; } | (() => { [x: string]: unknown; })`, optional)
  Additional properties to publish as part of the OpenTelemetry resource definition for all OpenTelemetry signals, 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?DefaultValue%`).
- **`addResourceAttributesToAttributes`** (`boolean`, optional) default: `false`
  Whether to add resource attributes to signal attributes.
- **`applicationName`** (`string`, optional)
  Application name to use in telemetry information. By default, it's populated by io.Connect.
- **`enabled`** (`boolean`, required)
  Whether library is enabled.
  If disabled, API is still usable, but methods are no-ops.
- **`errorlessMode`** (`boolean`, optional) default: `false`
  If `true`, the library will swallow all errors, instead of propagating them.
- **`failOnInitError`** (`boolean`, optional)
  If failure to initialize library will throw upstream error.
- **`headers`** (`{ [x: string]: string; } | (() => { [x: string]: string; }) | (() => Promise<{ [x: string]: string; }>)`, optional)
  Additional headers to send in HTTP requests, e.g. when using HTTP exporters.
- **`metrics`** (`MetricsSettings`, optional)
  Settings for publishing io.Insights metrics.
- **`platformVersion`** (`string`, optional)
  If provided, this value will be added to the metrics and span attributes
  and to the span filtering context (see 'filters' in TracesSettings).
- **`registerGlobalOTELObjects`** (`boolean | "force"`, optional) default: `true`
  Whether the library should register its own instances of the OTEL SDK global objects,
  e.g. MeterProvider. This is useful for controlling which instance of the SDK is used,
  in applications that initialize their own SDK.

  If `true`, the io.Insights library will register its own OTEL SDK global object instances
  if none are already registered. This means an already initialized SDK will be used in preference
  to the one initialized by io.Insights.

  If `"force"`, the io.Insights library will register its own OTEL SDK global object instances
  unconditionally, regardless of any existing registrations. This means any already initialized SDK
  will not be used and the library will always use its own instance.

  If `false`, the io.Insights library will not register its own OTEL SDK global object instances. The
  library will require an already initialized OTEL SDK instance.
- **`serviceId`** (`string`, optional)
  If provided, this value will be added to the metrics and traces service.instance.id attribute,
  unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
  a different setting.
- **`serviceName`** (`string`, optional)
  If provided, this value will be added to the metrics and traces service.name attribute,
  unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
  a different setting.
- **`serviceVersion`** (`string`, optional)
  If provided, this value will be added to the metrics and traces service.version attribute,
  unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
  a different setting.
  attribute.
- **`traces`** (`TracesSettings`, optional)
  Settings for publishing io.Insights traces.
- **`useExistingOTELSDK`** (`boolean`, optional) default: `false`
  If `true`, io.Insights publishes through the host application's own
  OTEL SDK instead of building providers of its own: the tracer, meter
  and logger providers are taken from the OTEL API globals
  unconditionally (the globals are never absent - unregistered APIs
  return proxy/noop providers, so there is no meaningful fallback).

  Ordering matters: the trace and logs globals are proxies that
  late-bind, so signals emitted before the host registers its SDK are
  dropped and start flowing once it does; the metrics global is a
  snapshot, which io.Insights compensates for by re-resolving it per
  meter creation - but meters created before the host registered stay
  bound to the noop. Register the host SDK before initializing
  io.Insights for full coverage.

  In this mode io.Insights registers nothing: registerGlobalOTELObjects
  is effectively ignored, the global propagator is whatever the host
  registered (header injection rides it), resource attributes come from
  the host's providers (io.Insights resource settings are unused), and
  waitForFinalExport is best-effort - flushing on shutdown is the host
  SDK's responsibility.
- **`userId`** (`string`, optional)
  If provided, this value will be added to the metrics and traces user.id attribute,
  unless an OTEL service object (e.g. TraceProvider) has been provided to the library with
  a different setting.

## Related types

- [MetricsSettings](https://docs.interop.io/browser/reference/javascript/io.connect%20browser/insights.metricssettings/index.md)
- [TracesSettings](https://docs.interop.io/browser/reference/javascript/io.connect%20browser/insights.tracessettings/index.md)
