# MetricsSettings

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

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

## Properties

- **`additionalAttributes`** (`{ [x: string]: unknown } | (() => { [x: string]: unknown })`, optional)
  Additional metrics properties to publish as part of each metric, 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%`).

  A function is asked once, on the first read after the build, and its answer is kept: the
  SDK's resource is made once, at its creation, and the readers that look at the resource
  attributes on every span (the span filters' context, the sampler) see the same values.
- **`addResourceAttributesToAttributes`** (`boolean`, optional) default: `false`
  Whether to add resource attributes to metric data point attributes.
- **`compression`** (`CompressionAlgorithm`, optional)
  Compression algorithm to use when exporting metrics.
- **`concurrencyLimit`** (`number`, optional)
  Maximum number of concurrent metric export requests.
- **`defaultFilters`** (`MetricFilter[]`, optional)
  This property is for internal use only.
- **`defaultPublishingSettings`** (`MetricPublishingSettings`, optional)
  Default publishing settings for metrics.
- **`dependencyContainerOverride`** (`MetricsDependencyContainer`, optional)
  Optional override for the dependency container providing platform-specific metric handlers.
- **`enabled`** (`boolean`, required) default: `false`
  Whether metrics functionality is enabled.
  If disabled, API is still usable, but methods are no-ops.
- **`exporterSettings`** (`(OTLPExporterNodeConfigBase & OTLPMetricExporterOptions)`, optional)
  Options to use when creating the OTLPMetricExporter to use when exporting metrics.
- **`filters`** (`MetricFilter[]`, optional)
  Array of filter rules to determine which metrics should be collected and exported.
- **`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.
- **`hostname`** (`string`, optional)
  Hostname to include in exported metrics.
- **`keepAlive`** (`boolean`, optional)
  Whether to use HTTP keep-alive connections for metric exports.
- **`maxAttributeDepth`** (`number`, optional) default: `5`
  How deep the library should recurse into objects when adding
  labels to metrics.
- **`meter`** (`Partial<MetricsSettings>`, optional)
  Partial MetricsSettings for meter configuration.
- **`meterProvider`** (`(meterProviderSettings: MeterProviderOptions, metricsSettings: IOInsights.MetricsSettings, settings: IOInsights.Settings) => MeterProvider`, optional)
- **`meterProviderSettings`** (`MeterProviderOptions`, optional)
- **`metricExporters`** (`(exporterSettings: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions, tracesSettings: IOInsights.MetricsSettings, settings: IOInsights.Settings) => PushMetricExporter[]`, optional)
  Custom metric exporter implementations for pushing metrics.
- **`metricReaders`** (`(readerSettings: Partial<PeriodicExportingMetricReaderOptions>, exporterSettings: OTLPExporterNodeConfigBase & OTLPMetricExporterOptions, tracesSettings: IOInsights.MetricsSettings, settings: IOInsights.Settings) => MetricReader[]`, optional)
  Custom metric reader implementations for pushing metrics.
- **`metrics`** (`MetricSettings[]`, optional)
  Array of custom metric configurations. It allows specifying overrides for both platform and custom metrics.
- **`platformMetricsEnabled`** (`boolean | "only-explicit"`, optional)
  Whether to enable automatic collection of platform-level metrics (CPU, memory, etc.).
  If `true`, the library will initialize all predefined platform metrics automatically.
  If `only-explicit`, it will not initialize them automatically, but will still allow you to
  configure your own platform metrics based on the predefined types using the `metrics` config property.
  If `false`, any platform metrics will be automatically disabled.
- **`publishInterval`** (`number`, optional) default: `30_000`
  Interval in milliseconds between metric export batches.
- **`readerSettings`** (`PeriodicExportingMetricReaderOptions`, optional)
  Options to use when creating the PeriodicExportingMetricReader to use when exporting metrics.
- **`ssoAuth`** (`SSOAuthSettings`, optional)
  Overrides the properties of the top-level `ssoAuth` for the metrics export requests; the ones
  that aren't specified here are taken from it.
- **`timeoutMillis`** (`number`, optional) default: `10000ms.`
  Maximum time the OTLP exporter will wait for each batch export.
- **`url`** (`string`, optional)
  The destination URL for exporting metrics via OTLP.
- **`useDefaultFilters`** (`boolean`, optional) default: `true`
  Whether to apply predefined default filters for platform metrics.
- **`useLegacyWorkspaceStartupMetric`** (`boolean`, optional) default: `false`
  If `true`, workspace_startup will be published as the legacy histogram metric from
  the io.Insights beta releases.

## Related types

- [MetricFilter](https://docs.interop.io/browser/reference/javascript/insights/metricfilter/index.md)
- [MetricPublishingSettings](https://docs.interop.io/browser/reference/javascript/insights/metricpublishingsettings/index.md)
- [MetricSettings](https://docs.interop.io/browser/reference/javascript/insights/metricsettings/index.md)
- [SSOAuthSettings](https://docs.interop.io/browser/reference/javascript/insights/ssoauthsettings/index.md)
- [Settings](https://docs.interop.io/browser/reference/javascript/insights/settings/index.md)
