/** * @since 1.0.0 */ import type { LazyArg } from "@effect/data/Function" import type { Pipeable } from "@effect/data/Pipeable" import * as internal from "@effect/io/internal/metric/hook" import type * as MetricKey from "@effect/io/MetricKey" import type * as MetricState from "@effect/io/MetricState" /** * @since 1.0.0 * @category symbols */ export const MetricHookTypeId: unique symbol = internal.MetricHookTypeId /** * @since 1.0.0 * @category symbols */ export type MetricHookTypeId = typeof MetricHookTypeId /** * @since 1.0.0 * @category models */ export interface MetricHook extends MetricHook.Variance, Pipeable { readonly get: () => Out readonly update: (input: In) => void } /** * @since 1.0.0 */ export declare namespace MetricHook { /** * @since 1.0.0 * @category models */ export type Root = MetricHook /** * @since 1.0.0 * @category models */ export type Untyped = MetricHook /** * @since 1.0.0 * @category models */ export type Counter = MetricHook /** * @since 1.0.0 * @category models */ export type Gauge = MetricHook /** * @since 1.0.0 * @category models */ export type Frequency = MetricHook /** * @since 1.0.0 * @category models */ export type Histogram = MetricHook /** * @since 1.0.0 * @category models */ export type Summary = MetricHook /** * @since 1.0.0 * @category models */ export interface Variance { readonly [MetricHookTypeId]: { readonly _In: (_: In) => void readonly _Out: (_: never) => Out } } } /** * @since 1.0.0 * @category constructors */ export const make: (options: { readonly get: LazyArg readonly update: (input: In) => void }) => MetricHook = internal.make /** * @since 1.0.0 * @category constructors */ export const counter: (_key: MetricKey.MetricKey.Counter) => MetricHook.Counter = internal.counter /** * @since 1.0.0 * @category constructors */ export const frequency: (_key: MetricKey.MetricKey.Frequency) => MetricHook.Frequency = internal.frequency /** * @since 1.0.0 * @category constructors */ export const gauge: (_key: MetricKey.MetricKey.Gauge, startAt: number) => MetricHook.Gauge = internal.gauge /** * @since 1.0.0 * @category constructors */ export const histogram: (key: MetricKey.MetricKey.Histogram) => MetricHook.Histogram = internal.histogram /** * @since 1.0.0 * @category constructors */ export const summary: (key: MetricKey.MetricKey.Summary) => MetricHook.Summary = internal.summary /** * @since 1.0.0 * @category utils */ export const onUpdate: { (f: (input: In) => void): (self: MetricHook) => MetricHook (self: MetricHook, f: (input: In) => void): MetricHook } = internal.onUpdate