Skip to content

Instantly share code, notes, and snippets.

@dam1r89
Created July 30, 2019 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dam1r89/c13aa897fae959285b47c30b451dd9db to your computer and use it in GitHub Desktop.
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.
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