JSPM

  • Created
  • Published
  • Downloads 268
  • Score
    100M100P100Q91267F
  • License Apache-2.0

Node.js agent framework for SPM by Sematext

Package Exports

  • spm-agent
  • spm-agent/lib/agent.js
  • spm-agent/lib/util/spmconfig.js
  • spm-agent/package.json

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (spm-agent) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

SPM Agent Framework for Node.js

Functionality

  • Sender interface to SPM backend receivers
  • Buffering metrics to disk in case of network outages (using NeDB)
  • Limit the file size of buffers
  • Reconnect after failures
  • Logging functions
  • Configuration handling
  • Pluggable agents

Example to implement a monitoring agent:

var SpmAgent = require('spm-agent')
var client = new SpmAgent()
var testAgent = client.createAgent(new SpmAgent.Agent ({
  start: function (agent) {
    // initialize your metrics collector ...
    this.tid = setInterval(function () {
      // get every 30 seconds some metrics 
      // SPM gets an array of metrics for a specific app
       agent.addMetrics({name: 'test-app', value: [1, 2, 3]})
    }, client.config.collectionInterval)
  }
}))
// monitor which values we added by "addMetrics"
testAgent.on ('metrics', console.log)

Let us know about monitoring agents you need, maybe you like to contribute with your domain expertise!

Please check spm-metrics-js to ship your application specific metrics to SPM.