Skip to content

Commit

Permalink
fix: typos, constants
Browse files Browse the repository at this point in the history
  • Loading branch information
AVVS committed Mar 7, 2017
1 parent 5401d6e commit 1bf739d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/httpServerAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ var https = require('https')
var cluster = require('cluster')
var domain = require('domain')

// constants
var FINISH_EVENT_NAME = 'finish'
var ABRUPT_CLOSE_EVENT_NAME = 'close'

module.exports = function httpServerAgent () {
var SpmAgent = require('spm-agent')
var Agent = SpmAgent.Agent
Expand All @@ -37,20 +41,18 @@ module.exports = function httpServerAgent () {
timer: timer,
stats: stats,
logger: logger,
histogram: histogram,
FINISH_EVENT_NAME: 'finish',
ABRUPT_CLOSE_EVENT_NAME: 'close'
histogram: histogram
}

// bind monitorHttp safely
safeProcess(ctx, monitorHttp)
var monitor = safeProcess(ctx, monitorHttp)

// setup monitoring agent
var hAgent = new Agent({
start: function (agent) {
this._agent = agent
patchHttpServer(monitorHttp)
patchHttpsServer(monitorHttp)
patchHttpServer(monitor)
patchHttpsServer(monitor)
var timerId = setInterval(function () {
var httpStats = stats.toJSON()
var responseTimes = histogram.toJSON()
Expand All @@ -61,8 +63,8 @@ module.exports = function httpServerAgent () {
httpStats['3xxRate'] ? httpStats['3xxRate'].count : 0, // http.3xx (int)
httpStats['4xxRate'] ? httpStats['4xxRate'].count : 0, // http.4xx (int)
httpStats['5xxRate'] ? httpStats['5xxRate'].count : 0, // http.5xx (int)
reqSize,
resSize,
ctx.reqSize,
ctx.resSize,
responseTimes.min,
responseTimes.max,
responseTimes.sum
Expand Down

0 comments on commit 1bf739d

Please sign in to comment.