Skip to content

Instantly share code, notes, and snippets.

@brianr
Last active August 29, 2015 14:09
Show Gist options
  • Select an option

  • Save brianr/5c439c2306a12fa46c89 to your computer and use it in GitHub Desktop.

Select an option

Save brianr/5c439c2306a12fa46c89 to your computer and use it in GitHub Desktop.
Rollbar transform to normalize filenames for multitenant sourcemap support
var _rollbarConfig = {
// ...
transform: function(payload) {
var trace = payload.data.body.trace;
if (trace && trace.frames) {
for (var i = 0; i < trace.frames.length; i++) {
var filename = trace.frames[i].filename;
if (filename) {
// we have a frame with a filename
// 1. TODO - check if the filename looks like it's part of our app (and not some external js)
// 2. TODO - if it does, replace the dynamic hostname with a constant string, like "dynamichost"
// Make sure to save it back to trace.frames[i].filename so that the original payload object is modified.
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment