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

Statements: 87.5% (7 / 8)      Branches: 85.71% (6 / 7)      Functions: 75% (3 / 4)      Lines: 87.5% (7 / 8)      Ignored: none     

All files » core/src/apm/local/ » 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      1     1       10 10         10 10                   10      
import {Tags} from '../../util';
import {Counter} from '../counter';
import {Resettable} from '../resettable';
import {LocalSettable} from './settable';
 
 
export class LocalCounter extends LocalSettable<number> implements Counter<number>, Resettable {
 
 
  constructor(name: string, tags: Tags = {}) {
    super(name, tags);
    this.set(0);
  }
 
 
  increment(value = 1, tags: Tags = {}): void {
    const update = (this.raw || 0) + value;
    this.set(update, tags);
  }
 
 
  reset(): void {
    this.set(0);
  }
 
 
  get raw(): number {
    return this._val.value || 0;
  }
}