pixl-server-web
Advanced tools
Comparing version 1.3.9 to 1.3.10
@@ -24,2 +24,11 @@ // Simple HTTP / HTTPS Web Server | ||
// take snapshot of req and socket counts at start of request, used by perf logger at end | ||
if (this.logPerfEnabled) { | ||
args._start = { | ||
pending: this.queue.length(), | ||
running: this.queue.running(), | ||
sockets: this.numConns | ||
}; | ||
} | ||
args.perf.begin(); | ||
@@ -26,0 +35,0 @@ |
@@ -324,2 +324,24 @@ // Simple HTTP / HTTPS Web Server | ||
// optional threshold-based perf log | ||
if (this.logPerfEnabled && (metrics.perf.total >= this.logPerfThreshold)) { | ||
var epoch = (Date.now() - metrics.perf.total) / 1000; | ||
this.logger.print({ | ||
now: epoch, // retroactive time (start of request) | ||
category: 'perf', | ||
code: args.http_code + ' ' + args.http_status, | ||
msg: args.request.url, | ||
data: { | ||
id: args.id, | ||
proto: args.request.headers['ssl'] ? 'https' : socket_data.proto, | ||
ips: args.ips, | ||
host: args.request.headers['host'] || '', | ||
ua: args.request.headers['user-agent'] || '', | ||
perf: metrics, | ||
pending: args._start.pending, | ||
running: args._start.running, | ||
sockets: args._start.sockets | ||
} | ||
}); | ||
} | ||
// keep a list of the most recent N requests | ||
@@ -326,0 +348,0 @@ if (this.keepRecentRequests) { |
{ | ||
"name": "pixl-server-web", | ||
"version": "1.3.9", | ||
"version": "1.3.10", | ||
"description": "A web server component for the pixl-server framework.", | ||
@@ -5,0 +5,0 @@ "author": "Joseph Huckaby <jhuckaby@gmail.com>", |
@@ -50,2 +50,4 @@ // Simple HTTP / HTTPS Web Server | ||
"http_log_requests": false, | ||
"http_log_perf": false, | ||
"http_perf_threshold_ms": 100, | ||
"http_recent_requests": 10, | ||
@@ -103,2 +105,4 @@ "http_max_connections": 0, | ||
this.regexLogRequests = this.logRequests ? (new RegExp( this.config.get('http_regex_log') || '.+' )) : null; | ||
this.logPerfEnabled = this.config.get('http_log_perf'); | ||
this.logPerfThreshold = this.config.get('http_perf_threshold_ms'); | ||
this.keepRecentRequests = this.config.get('http_recent_requests'); | ||
@@ -105,0 +109,0 @@ this.stats = { current: {}, last: {} }; |
Sorry, the diff of this file is too big to display
222472
3557
1594