-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TraceKit's regex for matching stacktraces in Chrome doesn't match anonymous functions #289
Comments
Yeah, we have a heavily modified TraceKit since we were modifying too much and it's abandoned. Don't run With that said, can you just provide a reference stack trace so I can see exactly what it looks like? The diff itself seems reasonable. I just want to personally see what it's filtering out now. |
Also, fwiw, our regex has been loosened up to catch more stuff than TraceKit's does. Their looks more complex, but we stripped it down so it wasn't as rigid. I'd err on the side of capturing more here. |
Cool, sounds good to me! Here's the stacktrace I was dealing with.
That's what the For super convenience here's a script you can paste into your console to see the difference in behavior.
If you like, I can put together a PR with a test case that includes a sample stacktrace with Chrome's phrasing, like this one, and the regex fix. |
Awesome, that makes sense to me. A PR would be appreciated. 👍 |
Hmm, in the example you posted, both the old and new fail since the regular expression assumes you'll get a fully qualified url, not just a path. So it doesn't match BUT, does Chrome dump a full url for the |
It still doesn't even match: I can look into this and match the case, but something's not adding up here. :) It sounds like you have it working somehow. |
Crud, I'm sorry! I "cleaned up" the URLs before posting, to hide some internal hostnames and stuff, and accidentally ruined them. Here's an actually working example!
|
Ah, ok. Yeah, that works now. :) |
It looks like
I'll start on that PR. |
PR opened with a test case! I did a small tweak to the regex I posted before... it's now:
I didn't notice earlier but in the working example I posted, the function name was being extracted as "object.context.execcb (" for example, when it should have been "object.context.execcb". By the way @mattrobenolt I really enjoyed the video of your talk at JSConf. A buddy of mine went, and told me about it. We have our own hand-rolled client logging solution at Red Hat, but I'm working on migrating us to Sentry+Raven because it's much better. |
In the version of TraceKit that Raven is including currently, this is the regex being used to match stacktrace entries in Chrome:
direct link
The part I marked there is a capture group for grabbing the name of the function. Notice that the regex as it currently is written, requires there be a least one character in the name. Anonymous functions don't have a name, so they get totally dropped from the stacktrace that gets reported to Sentry.
I dug into this when I was seeing errors in Sentry being attributed to the wrong file. Eventually I figured out it was only when the error occurred in an anonymous function that it was mis-attributed.
By changing the capture group to...
The error is fixed and all tests still pass...
TraceKit's latest version has a heavily revamped regex that does match anonymous functions, but just pulling the new version of TraceKit into Raven caused many tests to fail. :(
TraceKit also looks abandoned. No updates in over a year, several open issues and pull requests not being addressed.
Here's a link to my fix. I also ran
grunt dist
which looks like it pulled in a lot more changes into dist/raven.js than just mine. I guessgrunt dist
hasn't been run in a while. :)So I'm fine for now, but this is an extremely confusing issue to deal with. Any thoughts on how to best handle it, @mattrobenolt ?
The text was updated successfully, but these errors were encountered: