https://github.com/articulate/sox-newrelic
NewRelic integration for @articulate/sox
https://github.com/articulate/sox-newrelic
javascript newrelic socket-io
Last synced: about 2 months ago
JSON representation
NewRelic integration for @articulate/sox
- Host: GitHub
- URL: https://github.com/articulate/sox-newrelic
- Owner: articulate
- License: mit
- Created: 2018-10-03T19:07:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-03T20:51:02.000Z (over 7 years ago)
- Last Synced: 2024-04-24T17:58:29.467Z (about 2 years ago)
- Topics: javascript, newrelic, socket-io
- Language: JavaScript
- Homepage:
- Size: 38.1 KB
- Stars: 0
- Watchers: 58
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @articulate/sox-newrelic
[](https://www.npmjs.com/package/@articulate/sox-newrelic)
[](https://travis-ci.org/articulate/sox-newrelic)
[](https://coveralls.io/github/articulate/sox-newrelic?branch=master)
NewRelic integration for [`@articulate/sox`](https://github.com/articulate/sox).
## Usage
```haskell
instrument :: NewRelic -> (Action -> Promise Action) -> Action -> Promise Action
```
Wraps a top-level action handler to instrument for NewRelic.
```js
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:
```js
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)
```