@telemetry-js/processor-summarize

0.2.1 • Public • Published

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

Package Sidebar

Install

npm i @telemetry-js/processor-summarize

Weekly Downloads

1

Version

0.2.1

License

MIT

Unpacked Size

8.34 kB

Total Files

4

Last publish

Collaborators

  • vweevers