kopia lustrzana https://github.com/c9/core
Merge pull request +10027 from c9/report-request-timeouts
[TRIVIAL] Report request timeouts to datadog so we can see spikespull/223/head
commit
22ede6ec31
|
@ -4,7 +4,7 @@ var domain = require("domain");
|
||||||
var url = require("url");
|
var url = require("url");
|
||||||
var _ = require("lodash");
|
var _ = require("lodash");
|
||||||
|
|
||||||
plugin.consumes = ["raygun", "connect", "http", "connect.remote-address"];
|
plugin.consumes = ["raygun", "connect", "http", "connect.remote-address", "metrics"];
|
||||||
plugin.provides = ["raygun.connect"];
|
plugin.provides = ["raygun.connect"];
|
||||||
|
|
||||||
module.exports = plugin;
|
module.exports = plugin;
|
||||||
|
@ -15,6 +15,7 @@ function plugin(options, imports, register) {
|
||||||
var warningClient = raygun.warningClient;
|
var warningClient = raygun.warningClient;
|
||||||
var connect = imports.connect;
|
var connect = imports.connect;
|
||||||
var server = imports.http.getServer();
|
var server = imports.http.getServer();
|
||||||
|
var metrics = imports.metrics;
|
||||||
|
|
||||||
errorClient.user = warningClient.user = function(req) {
|
errorClient.user = warningClient.user = function(req) {
|
||||||
return (req && req.user) ? req.user.name : "";
|
return (req && req.user) ? req.user.name : "";
|
||||||
|
@ -60,8 +61,10 @@ function plugin(options, imports, register) {
|
||||||
|
|
||||||
var domain = socket._httpMessage && socket._httpMessage.domain;
|
var domain = socket._httpMessage && socket._httpMessage.domain;
|
||||||
var req = domain && domain.members[0];
|
var req = domain && domain.members[0];
|
||||||
if (req && req.url)
|
if (req && req.url) {
|
||||||
|
metrics.increment("request.timeout");
|
||||||
sendRequestWarning(new Error("Request timed out: " + req.url), req);
|
sendRequestWarning(new Error("Request timed out: " + req.url), req);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue