@articulate/sox-newrelic
v0.0.1
Published
NewRelic integration for @articulate/sox
Downloads
4
Readme
@articulate/sox-newrelic
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)