Skip to content

captureMessage can attach stack trace via stacktrace: true option #582

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

Merged
merged 9 commits into from
Aug 26, 2016

Conversation

benvinegar
Copy link
Contributor

@benvinegar benvinegar commented May 17, 2016

See also #581

cc @mattrobenolt @mitsuhiko @dcramer @bradvogel


This change is Reviewable

@benvinegar benvinegar force-pushed the capturemessage-stacktrace branch from 0a0ebf9 to c4956d0 Compare May 17, 2016 04:11
@mattrobenolt
Copy link
Contributor

Let's use the sentry.interface.Stacktrace interface explicitly and avoid sending along an Exception interface for the synthetic exception.

@benvinegar benvinegar force-pushed the capturemessage-stacktrace branch from c4956d0 to 407848e Compare July 1, 2016 00:20
@benvinegar
Copy link
Contributor Author

benvinegar commented Jul 1, 2016

Let's use the sentry.interface.Stacktrace interface explicitly and avoid sending along an Exception interface for the synthetic exception.

I mean, this is ideal, but to do so means a colossal refactor of Raven.js :( Let me dork around and see what it looks like.

@benvinegar
Copy link
Contributor Author

benvinegar commented Jul 1, 2016

Example of Raven.captureMessage('lol', { stacktrace: true }) in the UI (triggered from console so no source maps etc):

image

Edit: hmm, should have marked those Raven frames as in_app.

@@ -131,7 +131,7 @@ module.exports = function(grunt) {
dest: 'build/raven.test.js',
options: {
browserifyOptions: {
debug: true // source maps
debug: false// source maps
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Source map generation for tests is/has been broken so I just disabled it to make my life easier debugging this. I'll revisit in future.

@benvinegar benvinegar force-pushed the capturemessage-stacktrace branch from ecb0205 to 7fbf87b Compare July 6, 2016 00:01
@@ -363,6 +363,8 @@ Raven.prototype = {
ex = ex1;
}

console.log(ex.stack);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks.

@benvinegar benvinegar force-pushed the capturemessage-stacktrace branch from 9403f01 to 310280d Compare July 7, 2016 02:03
@benvinegar benvinegar changed the title captureMessage can attach stack trace via stacktrace: true option [WIP] captureMessage can attach stack trace via stacktrace: true option Jul 28, 2016
@benvinegar benvinegar force-pushed the capturemessage-stacktrace branch from 310280d to 722492b Compare July 28, 2016 01:12
@benvinegar
Copy link
Contributor Author

This is no longer WIP. My plan is to test this live on app.getsentry.com for a short while, then we'll roll it into 3.4.0.

@simon-weber
Copy link

@benvinegar Any updates on this? This would be a huge help for me 😁

@benvinegar
Copy link
Contributor Author

@simon-weber yep trying to push this through. Big changes like this make me nervous so I just need to QA ourselves first.

@benvinegar benvinegar force-pushed the capturemessage-stacktrace branch from 722492b to 22bebbd Compare August 24, 2016 22:22
benvinegar added a commit to getsentry/sentry that referenced this pull request Aug 24, 2016
benvinegar added a commit to getsentry/sentry that referenced this pull request Aug 24, 2016
@benvinegar
Copy link
Contributor Author

Okay, after some testing I've decided that attempting figure out the "tail" Raven frames has more cases than I've considered, so I've reverted that part of the code.

This now strictly just does synthetic stack traces via Raven.captureMessage (or as a fallback if captureException is given a string or non-error).

cc @mattrobenolt @macqueen – can you look at this again?

options = objectMerge({
// fingerprint on msg, not stack trace
// NOTE: need also to do this because stack could include Raven.wrap,
// which may create inconsistent traces if only using window.onerror
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand this comment anymore (re window.onerror) ... uhhhh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¯_(ツ)_/¯

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that comment was true until I added the trimHeadFrames stuff.

@macqueen
Copy link

Reviewed 2 of 3 files at r6, 3 of 3 files at r7.
Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


Comments from Reviewable

@macqueen
Copy link

Reviewed 1 of 1 files at r8.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from Reviewable

@benvinegar benvinegar merged commit e8040b1 into master Aug 26, 2016
@benvinegar benvinegar deleted the capturemessage-stacktrace branch August 26, 2016 23:46
@wearhere
Copy link

Cool! What version is this targeting? We're past 3.4.0 now.

@benvinegar
Copy link
Contributor Author

3.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants