Skip to main content

MetricsConfig

@horizon-republic/nestjs-jetstream


@horizon-republic/nestjs-jetstream / MetricsConfig

MetricsConfig

Defined in: src/metrics/metrics.config.ts:31

Configuration for built-in Prometheus metrics. All fields are optional; sensible production defaults are applied when missing.

Properties​

buckets?​

optional buckets?: HistogramBuckets

Defined in: src/metrics/metrics.config.ts:58

Override default histogram buckets.


defaultLabels?​

optional defaultLabels?: Record<string, string>

Defined in: src/metrics/metrics.config.ts:47

Labels merged into every metric. Useful for service/env tagging.


pollInterval?​

optional pollInterval?: number

Defined in: src/metrics/metrics.config.ts:55

Polling interval (ms) for gauge metrics that query JetStreamManager (consumer pending, stream messages, etc.). Default 15_000. Set to 0 to disable polling; counter/histogram metrics still update via the event bus.


prefix?​

optional prefix?: string

Defined in: src/metrics/metrics.config.ts:44

Metric name prefix. Defaults to 'jetstream_'.


register?​

optional register?: MetricsRegistry

Defined in: src/metrics/metrics.config.ts:41

Registry to write metrics into, from @prometheus-io/client or prom-client. The metrics are built with classes from the same package.

Defaults to the global register of whichever of the two is installed, which is also what @willsoto/nestjs-prometheus exposes via /metrics. Required when both are installed, because the two global registries are different objects and only one of them is scraped.