Skip to main content Link Search Menu Expand Document (external link)

MetricState overview

Added in v2.0.0


Table of contents


constructors

counter

Signature

export declare const counter: {
  (count: number): MetricState.Counter<number>
  (count: bigint): MetricState.Counter<bigint>
}

Added in v2.0.0

frequency

Signature

export declare const frequency: (occurrences: ReadonlyMap<string, number>) => MetricState.Frequency

Added in v2.0.0

gauge

Signature

export declare const gauge: { (count: number): MetricState.Gauge<number>; (count: bigint): MetricState.Gauge<bigint> }

Added in v2.0.0

histogram

Signature

export declare const histogram: (options: {
  readonly buckets: ReadonlyArray<readonly [number, number]>
  readonly count: number
  readonly min: number
  readonly max: number
  readonly sum: number
}) => MetricState.Histogram

Added in v2.0.0

summary

Signature

export declare const summary: (options: {
  readonly error: number
  readonly quantiles: ReadonlyArray<readonly [number, Option.Option<number>]>
  readonly count: number
  readonly min: number
  readonly max: number
  readonly sum: number
}) => MetricState.Summary

Added in v2.0.0

models

MetricState (interface)

A MetricState describes the state of a metric. The type parameter of a metric state corresponds to the type of the metric key (MetricStateType). This phantom type parameter is used to tie keys to their expected states.

Signature

export interface MetricState<in A> extends MetricState.Variance<A>, Equal.Equal, Pipeable {}

Added in v2.0.0

refinements

isCounterState

Signature

export declare const isCounterState: (u: unknown) => u is MetricState.Counter<number | bigint>

Added in v2.0.0

isFrequencyState

Signature

export declare const isFrequencyState: (u: unknown) => u is MetricState.Frequency

Added in v2.0.0

isGaugeState

Signature

export declare const isGaugeState: (u: unknown) => u is MetricState.Gauge<number | bigint>

Added in v2.0.0

isHistogramState

Signature

export declare const isHistogramState: (u: unknown) => u is MetricState.Histogram

Added in v2.0.0

isMetricState

Signature

export declare const isMetricState: (u: unknown) => u is MetricState.Counter<number | bigint>

Added in v2.0.0

isSummaryState

Signature

export declare const isSummaryState: (u: unknown) => u is MetricState.Summary

Added in v2.0.0

symbols

CounterStateTypeId

Signature

export declare const CounterStateTypeId: typeof CounterStateTypeId

Added in v2.0.0

CounterStateTypeId (type alias)

Signature

export type CounterStateTypeId = typeof CounterStateTypeId

Added in v2.0.0

FrequencyStateTypeId

Signature

export declare const FrequencyStateTypeId: typeof FrequencyStateTypeId

Added in v2.0.0

FrequencyStateTypeId (type alias)

Signature

export type FrequencyStateTypeId = typeof FrequencyStateTypeId

Added in v2.0.0

GaugeStateTypeId

Signature

export declare const GaugeStateTypeId: typeof GaugeStateTypeId

Added in v2.0.0

GaugeStateTypeId (type alias)

Signature

export type GaugeStateTypeId = typeof GaugeStateTypeId

Added in v2.0.0

HistogramStateTypeId

Signature

export declare const HistogramStateTypeId: typeof HistogramStateTypeId

Added in v2.0.0

HistogramStateTypeId (type alias)

Signature

export type HistogramStateTypeId = typeof HistogramStateTypeId

Added in v2.0.0

MetricStateTypeId

Signature

export declare const MetricStateTypeId: typeof MetricStateTypeId

Added in v2.0.0

MetricStateTypeId (type alias)

Signature

export type MetricStateTypeId = typeof MetricStateTypeId

Added in v2.0.0

SummaryStateTypeId

Signature

export declare const SummaryStateTypeId: typeof SummaryStateTypeId

Added in v2.0.0

SummaryStateTypeId (type alias)

Signature

export type SummaryStateTypeId = typeof SummaryStateTypeId

Added in v2.0.0

utils

MetricState (namespace)

Added in v2.0.0

Counter (interface)

Signature

export interface Counter<in out A extends number | bigint> extends MetricState<MetricKeyType.MetricKeyType.Counter<A>> {
  readonly [CounterStateTypeId]: CounterStateTypeId
  readonly count: A
}

Added in v2.0.0

Frequency (interface)

Signature

export interface Frequency extends MetricState<MetricKeyType.MetricKeyType.Frequency> {
  readonly [FrequencyStateTypeId]: FrequencyStateTypeId
  readonly occurrences: ReadonlyMap<string, number>
}

Added in v2.0.0

Gauge (interface)

Signature

export interface Gauge<in out A extends number | bigint> extends MetricState<MetricKeyType.MetricKeyType.Gauge<A>> {
  readonly [GaugeStateTypeId]: GaugeStateTypeId
  readonly value: A
}

Added in v2.0.0

Histogram (interface)

Signature

export interface Histogram extends MetricState<MetricKeyType.MetricKeyType.Histogram> {
  readonly [HistogramStateTypeId]: HistogramStateTypeId
  readonly buckets: ReadonlyArray<readonly [number, number]>
  readonly count: number
  readonly min: number
  readonly max: number
  readonly sum: number
}

Added in v2.0.0

Summary (interface)

Signature

export interface Summary extends MetricState<MetricKeyType.MetricKeyType.Summary> {
  readonly [SummaryStateTypeId]: SummaryStateTypeId
  readonly error: number
  readonly quantiles: ReadonlyArray<readonly [number, Option.Option<number>]>
  readonly count: number
  readonly min: number
  readonly max: number
  readonly sum: number
}

Added in v2.0.0

Untyped (interface)

Signature

export interface Untyped extends MetricState<any> {}

Added in v2.0.0

Variance (interface)

Signature

export interface Variance<in A> {
  readonly [MetricStateTypeId]: {
    readonly _A: Types.Contravariant<A>
  }
}

Added in v2.0.0