@articulate/sox-newrelic

0.0.1 • Public • Published

@articulate/sox-newrelic

@articulate/sox-newrelic Build Status Coverage Status

NewRelic integration for @articulate/sox.

Usage

instrument :: NewRelic -> (Action -> Promise Action) -> Action -> Promise Action

Wraps a top-level action handler to instrument for NewRelic.

const instrument = require('@articulate/sox-newrelic')
const io = require('socket.io')
const { mount } = require('@articulate/sox')
const newrelic = require('newrelic')
const { tap } = require('ramda')

const handler = require('./handler')

const app =
  instrument(newrelic, handler)

const sockets = server =>
  io(server).use(mount({ app }))

module.exports = tap(server)

If your handlers are split into modules, instrument is curried to make the following possible:

const { compose, mergeAll, tap, values } = require('ramda')
const instrument = require('@articulate/sox-newrelic')
const { handle, mount } = require('@articulate/sox')
const io = require('socket.io')
const newrelic = require('newrelic')

const handlers = require('require-dir')()

const app =
  compose(instrument(newrelic), handle, mergeAll, values)(handlers)

const sockets = server =>
  io(server).use(mount({ app }))

module.exports = tap(server)

Readme

Keywords

none

Package Sidebar

Install

npm i @articulate/sox-newrelic

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

5.42 kB

Total Files

6

Last publish

Collaborators

  • botzo