MetricKey
Constructors
Signature
declare const counter: {
(
name: string,
options?: {
readonly bigint?: false;
readonly description?: string;
readonly incremental?: boolean;
},
): Counter<number>;
(
name: string,
options: {
readonly bigint: true;
readonly description?: string;
readonly incremental?: boolean;
},
): Counter<bigint>;
};Creates a metric key for a categorical frequency table, with the specified name.
Signature
declare const frequency: (
name: string,
options?: {
readonly description?: string;
readonly preregisteredWords?: ReadonlyArray<string>;
},
) => MetricKey.Frequency;Creates a metric key for a gauge, with the specified name.
Signature
declare const gauge: {
(
name: string,
options?: {
readonly bigint?: false;
readonly description?: string;
},
): Gauge<number>;
(
name: string,
options: {
readonly bigint: true;
readonly description?: string;
},
): Gauge<bigint>;
};Creates a metric key for a histogram, with the specified name and boundaries.
Signature
declare const histogram: (
name: string,
boundaries: MetricBoundaries.MetricBoundaries,
description?: string,
) => MetricKey.Histogram;Creates a metric key for a summary, with the specified name, maxAge, maxSize, error, and quantiles.
Signature
declare const summary: (options: {
readonly description?: string;
readonly error: number;
readonly maxAge: Duration.DurationInput;
readonly maxSize: number;
readonly name: string;
readonly quantiles: ReadonlyArray<number>;
}) => MetricKey.Summary;Returns a new MetricKey with the specified tag appended.
Signature
declare const tagged: {
(
key: string,
value: string,
): <Type extends MetricKeyType<any, any>>(self: MetricKey<Type>) => MetricKey<Type>;
<Type extends MetricKeyType<any, any>>(
self: MetricKey<Type>,
key: string,
value: string,
): MetricKey<Type>;
};taggedWithLabels
Returns a new MetricKey with the specified tags appended.
Signature
declare const taggedWithLabels: {
(extraTags: readonly Array<MetricLabel>): <Type extends MetricKeyType<any, any>>(self: MetricKey<Type>) => MetricKey<Type>;
<Type extends MetricKeyType<any, any>>(self: MetricKey<Type>, extraTags: readonly Array<MetricLabel>): MetricKey<Type>;
}Models
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
interface MetricKey<out Type extends MetricKeyType.MetricKeyType<any, any>> extends Variance<Type>, Equal, Pipeable {
readonly description: Option<string>;
readonly keyType: Type;
readonly name: string;
readonly tags: readonly Array<MetricLabel>;
}Other
Refinements
isMetricKey
Signature
declare const isMetricKey: (
u: unknown,
) => u is MetricKey<MetricKeyType.MetricKeyType<unknown, unknown>>;Symbols
MetricKeyTypeId
Signature
declare const MetricKeyTypeId: unique symbol;MetricKeyTypeId type
Signature
type MetricKeyTypeId = typeof MetricKeyTypeId;
Creates a metric key for a counter, with the specified name.