Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A quick program thrown together to run some stats on an export of Bugsnag errors.
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
You can’t perform that action at this time.