diff options
Diffstat (limited to 'u/trace/metric/emittable.ts')
-rw-r--r-- | u/trace/metric/emittable.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/u/trace/metric/emittable.ts b/u/trace/metric/emittable.ts new file mode 100644 index 0000000..f3441ec --- /dev/null +++ b/u/trace/metric/emittable.ts @@ -0,0 +1,18 @@ +import { IEmittableMetric, MetricValue, MetricValueTag, Unit } from './index.js'; + +export class EmittableMetric implements IEmittableMetric { + constructor( + public readonly name: string, + public readonly unit: Unit, + ) {} + + public withValue(value: number): MetricValue { + return { + name: this.name, + unit: this.unit, + emissionTimestamp: Date.now(), + value, + _tag: MetricValueTag, + }; + } +} |