Code coverage report for node/src/apm/statsd/histogram.ts

Statements: 42.86% (3 / 7)      Branches: 0% (0 / 3)      Functions: 0% (0 / 3)      Lines: 42.86% (3 / 7)      Ignored: none     

All files » node/src/apm/statsd/ » histogram.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 391 1                                           1                              
import {Histogram, Tags, HistogramFactory} from '@btilford/ts-base-core';
import {StatsDMetric, StatsDOptions} from './metric';
 
 
class StatsDHistogram extends StatsDMetric implements Histogram<number> {
 
 
  set(value: number, tags: Tags = {}): void {
    this.statsd.histogram(
      this.name,
      value,
      this.options.sampleRate,
      {
        ...this.tags,
        ...tags,
      },
    );
  }
 
 
}
 
 
export class StatsDHistogramFactory extends HistogramFactory<number> {
  protected readonly options: StatsDOptions;
 
 
  constructor(options: StatsDOptions = {}) {
    super();
    this.options = { ...options };
  }
 
 
  histogram(name: string, tags: Tags = {}): Histogram<number> {
    return new StatsDHistogram(name, this.options, tags);
  }
 
}