sd-report
TypeScript icon, indicating that this package has built-in type declarations

1.1.4 • Public • Published

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)

Readme

Keywords

none

Package Sidebar

Install

npm i sd-report

Weekly Downloads

2

Version

1.1.4

License

MIT

Unpacked Size

59.2 kB

Total Files

21

Last publish

Collaborators

  • shuidifed