sd-report
v1.1.4
Published
a reporter for nodejs environment based on influxdb
Downloads
9
Readme
sd-report
a reporter for nodejs environment
Installation
$ npm install sd-report -S
or
$ yarn add sd-report
In Node.js:
const createReporters = require('sd-report')
const influxConfig = {
app: 'your project name',
address: 'your influxdb address',
types: {
access: {
measurement: 'access',
fieldSchema: {
count: 'i',
process_time: 'i'
},
tagSchema: {
metric_type: '*',
app: '*',
host: '*',
request_method: '*',
response_status: '*',
module_name: '*'
}
},
error: {
measurement: 'error',
fieldSchema: {
count: 'i'
},
tagSchema: {
metric_type: '*',
app: '*',
host: '*',
exception_type: '*'
}
},
memory: {
measurement: 'memory',
fieldSchema: {
rss: 'i',
heapTotal: 'i',
heapUsed: 'i',
external: 'i'
},
tagSchema: {
metric_type: '*',
app: '*',
host: '*'
}
}
}
}
const { reportAccess, reportError, reportMemory } = createReporters(influxConfig)
// report the memory info
setInterval(() => {
reportMemory(process.memoryUsage())
}, 60000)