Created
July 30, 2019 09:49
-
-
Save dam1r89/c13aa897fae959285b47c30b451dd9db to your computer and use it in GitHub Desktop.
When manually trying find application bottleneck this snippet will pull stack trace ignoring node_modules and filtering only my application code.
This file contains 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
try { throw Error() } catch (e) { | |
var stack = e.stack.split('\n').map(l => l.match(/\((.*).+\)/)).filter(Boolean) | |
.map(l => l[1]) | |
.filter(l => !l.includes('node_modules') && l.includes('/app/')) | |
.slice(1, 4) | |
console.count('findByUserAndNetworkId: ' + stack.join(' -> ')) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment