Last active
August 29, 2015 14:09
-
-
Save brianr/5c439c2306a12fa46c89 to your computer and use it in GitHub Desktop.
Rollbar transform to normalize filenames for multitenant sourcemap support
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 _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