Code coverage report for core/src/apm/console/counter.ts

Statements: 90% (9 / 10)      Branches: 100% (1 / 1)      Functions: 80% (4 / 5)      Lines: 90% (9 / 10)      Ignored: none     

All files » core/src/apm/console/ » counter.ts
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 42 43 44 45  1   1     1             3         3                     1         2 2         3        
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);
  }
 
}