Options
All
  • Public
  • Public/Protected
  • All
Menu

Summary Metric

Summaries calculate percentiles of observed values. One more feature for summaries, is the timer metric which can record duration of events.

Note that from statsd point of view, summaries are treated as histograms.

import { Summary } from '@mists/nestjs-metrics';

const summary = new Summary('metric_summary');

// force prometheus settings
const summary = new Summary('metric_summary', {
  prometheus: {
    help: 'This is a summary metric'
  }
})

// force statsd settings; if no settings are provided here,
// default settings will be used
const summary = new Summary('metric_summary', {
  statsd: {
    host: 'localhost',
    socketTimeout: 2000,
  }
})

Hierarchy

Index

Constructors

constructor

Properties

Protected name

name: string

Name used for the metric

Protected options

options: MetricOptions

Options for the metric
Depending on the metric technology used. Even though the MetricOptions support almost all options for each supported technology, be careful how you use and setup your options since they may generated strange behaviors that were not intended with this API.

Protected prometheusMetric

prometheusMetric: any

Protected statsdClient

statsdClient: any

Accessors

Protected statsdName

  • get statsdName(): string

Methods

observe

  • observe(value: number, tags?: Tags): void
  • Observe method.

    import { Histogram } from '@mists/nestjs-metrics';
    
    const histogram = new Histogram('metric_histogram');
    
    // will observe value 10 (custom value)
    histogram.observe(10);
    
    // will observe value 1, attaching also a `server_id` label
    histogram.observe(1, {server_id: 'instance_1'})

    Parameters

    • value: number

      Value to decrement with; default 1

    • Optional tags: Tags

      Tags to attach to the increment; optional

    Returns void

reset

  • reset(): void
  • Reset method.

    import { Histogram } from '@mists/nestjs-metrics';
    
    const histogram = new Histogram('metric_histogram');
    
    // will reset all histogram values
    histogram.reset();
    

    Returns void

startTimer

Legend

  • Property
  • Method
  • Constructor
  • Method
  • Inherited method
  • Protected property
  • Static method

Generated using TypeDoc