Skip to content

Latest commit

 

History

History
77 lines (52 loc) · 2.47 KB

README.md

File metadata and controls

77 lines (52 loc) · 2.47 KB

plugin-debug

Log metrics and task lifecycle events with debug, as a processor or publisher.
A telemetry plugin.

npm status node Test JavaScript Style Guide

Table of Contents

Click to expand

Usage

const telemetry = require('@telemetry-js/telemetry')()
const debug = require('@telemetry-js/plugin-debug')

telemetry.task()
  .process(debug)

  // And/or
  .publish(debug)

This plugin can fulfill both the role of processor and publisher. In addition, it can be inserted into a task multiple times, e.g. before and after a certain processor. If you do, set a custom debug scope to differentiate the output.

For example, we can log metrics before they are summarized and when they are published:

const telemetry = require('@telemetry-js/telemetry')()
const osmem = require('@telemetry-js/collector-osmem')
const simple = require('@telemetry-js/schedule-simple')
const summarize = require('@telemetry-js/processor-summarize')
const debug = require('@telemetry-js/plugin-debug')

telemetry.task()
  .collect(osmem)
  .schedule(simple, { interval: '5s' })
  .process(debug, { scope: 'telemetry:process'})
  .process(summarize, { window: '1m' })
  .publish(debug, { scope: 'telemetry:publish'})

Debug output can be enabled with the environment variable DEBUG=telemetry:* Please see debug for details.

Options

Yet to document.

Install

With npm do:

npm install @telemetry-js/plugin-debug

Acknowledgements

This project is kindly sponsored by Reason Cybersecurity Ltd.

reason logo

License

MIT © Vincent Weevers