Skip to content

telemetry-js/processor-summarize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

processor-summarize

Locally summarize metrics within a time window, to account for spikes and valleys in that window without increasing traffic cost of published metrics.
A telemetry plugin.

npm status node Test JavaScript Style Guide

Table of Contents

Click to expand

Usage

const telemetry = require('@telemetry-js/telemetry')()
const summarize = require('@telemetry-js/processor-summarize')

telemetry.task()
  .process(summarize, { window: '5m' })

This will group metrics flowing through the task by metric name and distinct tag set, and emit a summary metric for each every 5 minutes, inheriting name, unit, statistic and tags.

To ensure that asynchronously collected or processed metrics fall within the window, processor-summarize operates on the task's schedule too, rather than having its own timer. The window option should be a multiple of the interval of a task's schedule, so that collected metrics fall within a predictable window. For example, if the interval is 60 seconds, the window can be 300 seconds, but not 90 seconds.

API

Options

  • window: required, number (milliseconds) or string (e.g. 5m, 60s)
  • suffix: optional, boolean. If true, appends .summary to metric names. For testing purposes only, e.g. to publish both a raw and summarized metric for comparison.

Install

With npm do:

npm install @telemetry-js/processor-summarize

Acknowledgements

This project is kindly sponsored by Reason Cybersecurity Ltd.

reason logo

License

MIT © Vincent Weevers