1.1.5 • Published 10 years ago

instrumentor v1.1.5

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

Overview

instrumentor is intended to make it super easy to wrap modules in additional behavior.

instrumentor only works for modules that expose a single function which returns a promise.

How to use

First we need to get an instrumentor:

  var instrumentor = require('instrumentor')

Add instruments

Call use to add an instrument.

PLEASE NOTE the instrument list is global

  var logger   = require('logging_module')
  var profiler = require('profiler_module')

  instrumentor.use(logger)
  instrumentor.use(profiler)

Instrument a module

the instrument method returns an instrumented module, wrapped in all used instruments. The returned module behaves as expected - instrument's behaviors are transparent to the caller.

  var instrumented_module = instrumentor.instrument('raw_module')

  var raw_module_output = instrumented_module(args)

What is an instrument?

An instrument is module defines some behavior around promise events. instruments for not need to return a promise - they simply need to understand how to handle promise events (resolve, reject, and update) as well as the request event. request is the event that kicks off a module's invokation.

1.1.5

10 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago