MetricKey overview
Added in v2.0.0
Table of contents
constructors
counter
Creates a metric key for a counter, with the specified name.
Signature
export declare const counter: {
(
name: string,
options?: {
readonly description?: string | undefined
readonly bigint?: false | undefined
readonly incremental?: boolean | undefined
}
): MetricKey.Counter<number>
(
name: string,
options: {
readonly description?: string | undefined
readonly bigint: true
readonly incremental?: boolean | undefined
}
): MetricKey.Counter<bigint>
}
Added in v2.0.0
frequency
Creates a metric key for a categorical frequency table, with the specified name.
Signature
export declare const frequency: (
name: string,
options?:
| { readonly description?: string | undefined; readonly preregisteredWords?: ReadonlyArray<string> | undefined }
| undefined
) => MetricKey.Frequency
Added in v2.0.0
gauge
Creates a metric key for a gauge, with the specified name.
Signature
export declare const gauge: {
(
name: string,
options?: { readonly description?: string | undefined; readonly bigint?: false | undefined }
): MetricKey.Gauge<number>
(name: string, options: { readonly description?: string | undefined; readonly bigint: true }): MetricKey.Gauge<bigint>
}
Added in v2.0.0
histogram
Creates a metric key for a histogram, with the specified name and boundaries.
Signature
export declare const histogram: (
name: string,
boundaries: MetricBoundaries.MetricBoundaries,
description?: string
) => MetricKey.Histogram
Added in v2.0.0
summary
Creates a metric key for a summary, with the specified name, maxAge, maxSize, error, and quantiles.
Signature
export declare const summary: (options: {
readonly name: string
readonly maxAge: Duration.DurationInput
readonly maxSize: number
readonly error: number
readonly quantiles: ReadonlyArray<number>
readonly description?: string | undefined
}) => MetricKey.Summary
Added in v2.0.0
tagged
Returns a new MetricKey
with the specified tag appended.
Signature
export declare const tagged: {
(
key: string,
value: string
): <Type extends MetricKeyType.MetricKeyType<any, any>>(self: MetricKey<Type>) => MetricKey<Type>
<Type extends MetricKeyType.MetricKeyType<any, any>>(
self: MetricKey<Type>,
key: string,
value: string
): MetricKey<Type>
}
Added in v2.0.0
taggedWithLabels
Returns a new MetricKey
with the specified tags appended.
Signature
export declare const taggedWithLabels: {
(
extraTags: ReadonlyArray<MetricLabel.MetricLabel>
): <Type extends MetricKeyType.MetricKeyType<any, any>>(self: MetricKey<Type>) => MetricKey<Type>
<Type extends MetricKeyType.MetricKeyType<any, any>>(
self: MetricKey<Type>,
extraTags: ReadonlyArray<MetricLabel.MetricLabel>
): MetricKey<Type>
}
Added in v2.0.0
models
MetricKey (interface)
A MetricKey
is a unique key associated with each metric. The key is based on a combination of the metric type, the name and tags associated with the metric, an optional description of the key, and any other information to describe a metric, such as the boundaries of a histogram. In this way, it is impossible to ever create different metrics with conflicting keys.
Signature
export interface MetricKey<out Type extends MetricKeyType.MetricKeyType<any, any>>
extends MetricKey.Variance<Type>,
Equal.Equal,
Pipeable {
readonly name: string
readonly keyType: Type
readonly description: Option.Option<string>
readonly tags: ReadonlyArray<MetricLabel.MetricLabel>
}
Added in v2.0.0
refinements
isMetricKey
Signature
export declare const isMetricKey: (u: unknown) => u is MetricKey<MetricKeyType.MetricKeyType<unknown, unknown>>
Added in v2.0.0
symbols
MetricKeyTypeId
Signature
export declare const MetricKeyTypeId: typeof MetricKeyTypeId
Added in v2.0.0
MetricKeyTypeId (type alias)
Signature
export type MetricKeyTypeId = typeof MetricKeyTypeId
Added in v2.0.0
utils
MetricKey (namespace)
Added in v2.0.0
Variance (interface)
Signature
export interface Variance<out Type> {
readonly [MetricKeyTypeId]: {
_Type: Types.Covariant<Type>
}
}
Added in v2.0.0
Counter (type alias)
Signature
export type Counter<A extends number | bigint> = MetricKey<MetricKeyType.MetricKeyType.Counter<A>>
Added in v2.0.0
Frequency (type alias)
Signature
export type Frequency = MetricKey<MetricKeyType.MetricKeyType.Frequency>
Added in v2.0.0
Gauge (type alias)
Signature
export type Gauge<A extends number | bigint> = MetricKey<MetricKeyType.MetricKeyType.Gauge<A>>
Added in v2.0.0
Histogram (type alias)
Signature
export type Histogram = MetricKey<MetricKeyType.MetricKeyType.Histogram>
Added in v2.0.0
Summary (type alias)
Signature
export type Summary = MetricKey<MetricKeyType.MetricKeyType.Summary>
Added in v2.0.0
Untyped (type alias)
Signature
export type Untyped = MetricKey<any>
Added in v2.0.0