1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-10 17:53:36 +02:00

Add type for MetricValue

This commit is contained in:
Gastón Fournier 2024-10-15 13:22:48 +02:00
parent 73f355984d
commit 4806106fc4
No known key found for this signature in database
GPG Key ID: AF45428626E17A8E

View File

@ -4,15 +4,11 @@ import { createGauge, type Gauge } from './util/metrics';
type RestrictedRecord<T extends readonly string[]> = Record<T[number], string>; type RestrictedRecord<T extends readonly string[]> = Record<T[number], string>;
type Query<R> = () => Promise<R | undefined | null>; type Query<R> = () => Promise<R | undefined | null>;
type MapResult<R> = (result: R) => type MetricValue<R> = {
| { count: number;
count: number; labels: RestrictedRecord<GaugeDefinition<R>['labelNames']>;
labels: RestrictedRecord<GaugeDefinition<R>['labelNames']>; };
} type MapResult<R> = (result: R) => MetricValue<R> | MetricValue<R>[];
| {
count: number;
labels: RestrictedRecord<GaugeDefinition<R>['labelNames']>;
}[];
type GaugeDefinition<T> = { type GaugeDefinition<T> = {
name: string; name: string;