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 { readonly name: string; readonly unit: Unit; readonly value: number; readonly emissionTimestamp: number; } export interface IEmittableMetric { readonly name: string; readonly unit: Unit; readonly withValue: Mapper; } 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 { 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.js'; export * from './metric.js'; export * from './trace.js';