Created
April 9, 2015 19:11
-
-
Save adunkman/3589fbfcc9386b0b7054 to your computer and use it in GitHub Desktop.
A quick program thrown together to run some stats on an export of Bugsnag errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require("./vendor/assets/javascripts/vendor/underscore.js"); | |
var parts = [ | |
require("/Users/adunkman/Downloads/arc-response-2015 Apr 9 11-21-29.json"), | |
require("/Users/adunkman/Downloads/arc-response-2015 Apr 9 11-23-02.json") | |
]; | |
var complete = parts.reduce(function (a, b) { return a.concat(b); }); | |
var reportBy = function (name, grouper) { | |
var report = {}; | |
var groups = _.groupBy(complete, grouper); | |
_.each(groups, function (errors, value) { | |
var percent = Math.round(errors.length / complete.length * 100); | |
report[value] = "" + errors.length + " (" + percent + "%)"; | |
}); | |
console.log(name + ": " + JSON.stringify(report, null, 2)); | |
}; | |
reportBy("Browser", function (error) { | |
return error.meta_data.Device.browserName + " " + error.meta_data.Device.browserVersion; | |
}); | |
reportBy("Last Event Target", function (error) { | |
return error.meta_data["Last Event"].target; | |
}); | |
reportBy("Last Event Type", function (error) { | |
return error.meta_data["Last Event"].type; | |
}); | |
var url = require("url"); | |
reportBy("Timesheet View", function (error) { | |
var parts = url.parse(error.meta_data.Request.url); | |
var regex = /^(\/[^\/]+\/[^\/]+)/; | |
var m; | |
return (m = parts.pathname.match(regex)) ? m[1] + "*" : parts.pathname; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment