Skip to content

Log metrics and task lifecycle events with debug(), as a processor or publisher.

License

Notifications You must be signed in to change notification settings

telemetry-js/plugin-debug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Log metrics and task lifecycle events with debug(), as a processor or publisher.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published