import {Tags} from '../../util';
import {Counter, CounterFactory} from '../counter';
import {Resettable} from '../resettable';
import {ConsoleMetric, ConsoleMetricOptions} from './metric';
export class ConsoleCounter extends ConsoleMetric implements Counter<number>, Resettable {
constructor(
name: string,
tags: Tags,
options: ConsoleMetricOptions,
) {
super(name, tags, options, 'counter');
}
increment(): void {
this.console.count(this.fqn);
}
reset(): void {
this.console.countReset(this.fqn);
}
}
export class ConsoleCounterFactory extends CounterFactory<number> {
protected readonly options: ConsoleMetricOptions;
constructor(options: ConsoleMetricOptions) {
super();
this.options = options;
}
counter(name: string, tags: Tags = {}): Counter<number> {
return new ConsoleCounter(name, tags, this.options);
}
}
|