blob: aebc8906b459bad3e20a62a7aeba24e8f565ad85 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
import { isTagged, Tagged, type Mapper } from '@emprespresso/pengueno';
export enum Unit {
COUNT = 'COUNT',
MILLISECONDS = 'MILLISECONDS',
}
export const MetricValueTag = 'MetricValue' as const;
export type MetricValueTag = typeof MetricValueTag;
export const isMetricValue = (t: unknown): t is MetricValue => isTagged(t, MetricValueTag);
export interface MetricValue extends Tagged<MetricValueTag> {
readonly name: string;
readonly unit: Unit;
readonly value: number;
readonly emissionTimestamp: number;
}
export interface IEmittableMetric {
readonly name: string;
readonly unit: Unit;
readonly withValue: Mapper<number, MetricValue>;
}
export const IMetricTag = 'IMetric' as const;
export type IMetricTag = typeof IMetricTag;
export const isIMetric = (t: unknown): t is IMetric => isTagged(t, IMetricTag);
export interface IMetric extends Tagged<IMetricTag> {
readonly count: IEmittableMetric;
readonly time: IEmittableMetric;
readonly parent: undefined | IMetric;
}
export interface IResultMetric extends IMetric {
readonly failure: IMetric;
readonly success: IMetric;
readonly warn: IMetric;
}
export * from './emittable';
export * from './metric';
export * from './trace';
|