# ResourceInstrumentationConfig

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

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

Configuration for the resource load instrumentation.

The phase metrics record nonzero samples only: with connection reuse most
requests have no DNS/TCP/TLS phase at all, and recording those zeros would
drown the distributions. Each histogram therefore answers "when this phase
happened, what did it cost". Cross-origin resources without a
Timing-Allow-Origin header withhold the detailed timings and sizes and
contribute no phase/throughput samples.

## Properties

- **`cacheStateMetric`** (`boolean | string | null`, optional) default: `false`
  If `true` or a string, a counter of observed resource loads by cache state is
  published ("io.insights.resource.cache.state" unless a string names it),
  tagged with cacheState ("hit" / "revalidated" / "network" / "unknown") and
  server.address/server.port - the cache hit ratio falls out at query time.
- **`connectDurationMetric`** (`boolean | string | null`, optional) default: `false`
  If `true` or a string, connection establishment durations (connectStart until
  connectEnd - includes the TLS handshake when one happened) are published as a
  histogram metric ("io.insights.resource.connect.duration" unless a string
  names it). Nonzero connects only.
- **`connectDurationMetricBuckets`** (`number[]`, optional) default: `[0.001, 0.0025, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5]`
  Explicit histogram bucket boundaries for connectDurationMetric, in seconds, ascending.
- **`dnsDurationMetric`** (`boolean | string | null`, optional) default: `false`
  If `true` or a string, DNS lookup durations are published as a histogram
  metric ("io.insights.resource.dns.duration" unless a string names it).
  Nonzero lookups only. Tagged with server.address/server.port and the ALPN protocol.
- **`dnsDurationMetricBuckets`** (`number[]`, optional) default: `[0.001, 0.0025, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5]`
  Explicit histogram bucket boundaries for dnsDurationMetric, in seconds, ascending.
- **`downloadThroughputMetric`** (`boolean | string | null`, optional) default: `false`
  If `true` or a string, effective download throughput (encodedBodySize over the
  responseStart-responseEnd window, in bytes per second) is published as a
  histogram metric ("io.insights.resource.download.throughput" unless a string
  names it). "network" cache state only, and only bodies of at least
  downloadThroughputMinBytes - smaller transfers complete within the initial
  congestion window and would measure round-trip time, not bandwidth. Note this
  is per-stream effective throughput: concurrent downloads share the link, so it
  reflects what a transfer experienced, not link capacity. For a byte-weighted
  aggregate, sum sizes and durations at query time instead of averaging rates.
- **`downloadThroughputMetricBuckets`** (`number[]`, optional) default: `[65536, 262144, 1048576, 4194304, 16777216, 67108864, 268435456]`
  Explicit histogram bucket boundaries for downloadThroughputMetric, in bytes
  per second, ascending.
- **`downloadThroughputMinBytes`** (`number`, optional) default: `32768`
  Minimum encodedBodySize, in bytes, for a resource to contribute a
  downloadThroughputMetric sample.
- **`enabled`** (`boolean`, required)
  Whether the resource instrumentation is enabled.
- **`firstByteDurationMetric`** (`boolean | string | null`, optional) default: `false`
  If `true` or a string, resource time-to-first-byte (requestStart until
  responseStart) is published as a histogram metric
  ("io.insights.resource.ttfb.duration" unless a string names it). Measures the
  asset-serving infrastructure, distinct from the request instrumentation's TTFB
  metric which covers fetch/XHR API traffic. Samples only resources that
  actually hit the network ("network" and "revalidated" cache states) - cache
  hits would contribute disk latency, not server latency.
- **`firstByteDurationMetricBuckets`** (`number[]`, optional) default: `[0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10]`
  Explicit histogram bucket boundaries for firstByteDurationMetric, in seconds, ascending.
- **`skipRequests`** (`boolean`, optional) default: `true`
  If `true`, resource timing entries produced by fetch/XMLHttpRequest are
  skipped entirely (the request instrumentation covers those requests in more
  detail). Set to `false` to also publish resource spans and metric samples
  for them - e.g. to include API backends in the connection-phase and
  throughput metrics. Beacon entries and telemetry uploads are always skipped.
- **`tlsDurationMetric`** (`boolean | string | null`, optional) default: `false`
  If `true` or a string, TLS handshake durations (secureConnectionStart until
  connectEnd - a subset of the connect duration) are published as a histogram
  metric ("io.insights.resource.tls.duration" unless a string names it).
  Secure connections only.
- **`tlsDurationMetricBuckets`** (`number[]`, optional) default: `[0.001, 0.0025, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5]`
  Explicit histogram bucket boundaries for tlsDurationMetric, in seconds, ascending.
- **`trace`** (`boolean`, optional) default: `true`
  If `false`, no resource spans are published - metrics-only mode: the
  phase/TTFB/throughput histograms and the cache-state counter keep reporting.
