Locally summarize metrics within a time window
npm install @telemetry-js/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.




Click to expand
- Usage
- API
- Options
- Install
- Acknowledgements
- License
``js
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.
- 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.
With npm do:
```
npm install @telemetry-js/processor-summarize
This project is kindly sponsored by Reason Cybersecurity Ltd.

MIT © Vincent Weevers