elastic-apm-utils
Utilities for Elastic APM
Installation
$ npm install elastic-apm-utils
API
APM
apmUtils.apm.spanFilter({ filterShorterThan })
Filters spans.
apmClient.addSpanFilter(apmUtils.apm.spanFilter({
filterShorterThan: 10,
}));
apmUtils.apm.addTransactionFilter({ keepRequest, keepResponse, keepSocket })
Filters request
and response
properties.
apmClient.transactionFilter(apmUtils.apm.transactionFilter({
filterNotSampled: true,
keepRequest: [ 'referer', 'user-agent' ],
keepResponse: [],
keepSocket: [],
}));
Express integration
apmUtils.express.middleware(apmClient, { setAddress, setOrigin })
Returns an express middleware.
server.use(apmUtils.express.middleware(apmCient, {
setAddress: true,
setOrigin: true,
}));
Koa integration
apmUtils.koa.middleware(apmClient, { prefix, setAddress, setOrigin, setRouteName })
Returns a koa middleware.
router.use(apmUtils.koa.middleware(apmCient, {
prefix: '',
setAddress: true,
setOrigin: true,
setRouteName: true,
}));
License
Copyright (c) 2018 Martin Kolárik. Released under the MIT license.