teamcyst-datadog
v1.8.0
Published
collect application metrics to datadog
Downloads
2
Readme
teamcyst-datadog
streams application metrics and logs to datadog
Installation
$ npm install teamcyst-datadog
Usage
set DATADOG_API_KEY
to your datadog api key in your .env file
Options
const dataDogOpts = {
host: "myhost",
prefix: "node-api.",
service: "node-api",
ddsource: "api"
}
Examples
const { metrics, requestLogger, errorLogger } = require("teamcyst-datadog");
// collection application metrics
app.use(metrics(dataDogOpts));
// log incoming requests and outgoing responses
app.use(requestLogger(dataDogOpts));
//log errors that may occur during a request
/**
* if you are using an error middleware to handle errors,
* apply this middleware before the error handling middleware
*
*/
app.use(errorLogger(dataDogOpts, 'error'));