Skip to content

MetricHook

12 exports Added in v2.0.0 Source

Constructors

counter

Added in v2.0.0 Source

Signature

declare const counter: <A extends number | bigint>(
  key: MetricKey.MetricKey.Counter<A>,
) => MetricHook.Counter<A>;

frequency

Added in v2.0.0 Source

Signature

declare const frequency: (_key: MetricKey.MetricKey.Frequency) => MetricHook.Frequency;

gauge

Added in v2.0.0 Source

Signature

declare const gauge: {
  (key: Gauge<number>, startAt: number): Gauge<number>;
  (key: Gauge<bigint>, startAt: bigint): Gauge<bigint>;
};

histogram

Added in v2.0.0 Source

Signature

declare const histogram: (key: MetricKey.MetricKey.Histogram) => MetricHook.Histogram;

make

Added in v2.0.0 Source

Signature

declare const make: <In, Out>(options: {
  readonly get: LazyArg<Out>;
  readonly modify: (input: In) => void;
  readonly update: (input: In) => void;
}) => MetricHook<In, Out>;

summary

Added in v2.0.0 Source

Signature

declare const summary: (key: MetricKey.MetricKey.Summary) => MetricHook.Summary;

Models

MetricHook interface

Added in v2.0.0 Source

Signature

interface MetricHook<in In, out Out> extends Variance<In, Out>, Pipeable {
  get(): Out;
  modify(input: In): void;
  update(input: In): void;
}

Other

MetricHook

Added in v2.0.0 Source

Symbols

Signature

declare const MetricHookTypeId: unique symbol;

MetricHookTypeId type

Added in v2.0.0 Source

Signature

type MetricHookTypeId = typeof MetricHookTypeId;

Utils

onModify

Added in v3.6.5 Source

Signature

declare const onModify: {
  <In, Out>(f: (input: In) => void): (self: MetricHook<In, Out>) => MetricHook<In, Out>;
  <In, Out>(self: MetricHook<In, Out>, f: (input: In) => void): MetricHook<In, Out>;
};

onUpdate

Added in v2.0.0 Source

Signature

declare const onUpdate: {
  <In, Out>(f: (input: In) => void): (self: MetricHook<In, Out>) => MetricHook<In, Out>;
  <In, Out>(self: MetricHook<In, Out>, f: (input: In) => void): MetricHook<In, Out>;
};