koa-newrelic-route

2.0.2 • Public • Published

koa-newrelic-route

Explicity set name a to each newrelic transaction according to the matching Koa route.

Installation

If you use generator functions as route handlers then install:

npm i --save koa-newrelic-route@beta

If you async functions, or functions that return promises as route handlers then install:

npm i --save koa-newrelic-route@promises

Example

    const newrelicRoute = require('koa-newrelic-route');
    const newrelic = require('newrelic');
    
    const routes = {
        get: {
            '/api/v1/resource/1': function* () {
                this.status = 200;
            },
            '/api/v1/resource/2': function* () {
                this.status = 200;
            }
        },
        post: {
            '/api/v1/resource/1': function* () {
                this.status = 200;
            },
            '/api/v1/resource/2': function* () {
                this.status = 200;
            }
        }
    };
    
    newrelicRoute(routes, newrelic);
    

License

MIT

Versions

Current Tags

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.2
    2
  • 2.0.1
    1
  • 2.0.0
    1
  • 1.0.0
    1

Package Sidebar

Install

npm i koa-newrelic-route

Weekly Downloads

4

Version

2.0.2

License

MIT

Last publish

Collaborators

  • pmatzavin