newrelic-node
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -65,4 +65,22 @@ var sys = require('util'); | ||
var path = url.parse(req.url).pathname; | ||
this.log({"timespent":timespent, "path":path, "httpStatus":res.statusCode, "httpMethod":req.method}); | ||
this.log({"timespent":{URI_WEB_TRANSACTION:timespent}, "path":path, "httpStatus":res.statusCode, "httpMethod":req.method}); | ||
} | ||
}; | ||
exports.logRequestError = function(messsage, req, res, timespent){ | ||
if (connected) { | ||
var path = url.parse(req.url).pathname; | ||
this.log({"timespent":{URI_WEB_TRANSACTION:timespent}, "path":path, "httpStatus":res.statusCode, "httpMethod":req.method, "error":messsage}); | ||
} | ||
}; | ||
exports.logWebTransactionExternalAll = function(req, res, timespent){ | ||
if (connected) { | ||
var path = url.parse(req.url).pathname; | ||
this.log({"timespent":{WEB_TRANSACTION_EXTERNAL_ALL: timespent}, "path":path, "httpStatus":res.statusCode, "httpMethod":req.method}); | ||
} | ||
}; | ||
{ "name" : "newrelic-node" | ||
, "description" : "Logger para newrelic" | ||
, "tags" : ["newrelic"] | ||
, "version" : "0.0.7" | ||
, "version" : "0.0.8" | ||
, "author" : "Matias Rege <matias.rege@mercadolibre.com>" | ||
@@ -6,0 +6,0 @@ , "repository" : |
@@ -49,3 +49,3 @@ var newrelic = require( "../newrelic-node.js" ); | ||
done(); | ||
}, 4000); | ||
}, 2000); | ||
}).listen(8085); | ||
@@ -59,3 +59,38 @@ request({ | ||
}); | ||
it("envio de error",function(done){ | ||
this.timeout(5000); | ||
http.createServer(function(request, response) { | ||
response.writeHead(500, {}); | ||
newrelic.logRequestError("Un error", request, response, 5000); | ||
setTimeout(function() { | ||
done(); | ||
}, 2000); | ||
}).listen(8086); | ||
request({ | ||
url:"http://127.0.0.1:8086/pingError", | ||
method:"GET", | ||
jar: false | ||
},function(error,response,body){ | ||
}) | ||
}); | ||
it("log WEB_TRANSACTION_EXTERNAL_ALL",function(done){ | ||
this.timeout(5000); | ||
http.createServer(function(request, response) { | ||
response.writeHead(200, {}); | ||
newrelic.logWebTransactionExternalAll(request, response, 5000); | ||
setTimeout(function() { | ||
done(); | ||
}, 2000); | ||
}).listen(8087); | ||
request({ | ||
url:"http://127.0.0.1:8087/ping", | ||
method:"GET", | ||
jar: false | ||
},function(error,response,body){ | ||
}) | ||
}); | ||
}) | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
152
2742570
23
26