Raygun Feature Request

Feature Request

Add ability to pass in a custom stack trace to RaygunClient.Send()

Current Status:

Completed


Avatar

KendallB

If we are trying to capture an error without an exception, sometimes we need to know WHERE the call came from, and at the point that we capture an exception the exception only contains the stack trace from where the exception was thrown up until where it was captured, which is only part of the story. Internally Raygun builds the stack trace from the exception stack trace, but if it was possible to pass in a custom stack trace (new StackTrace() in C#) then it would actually build a complete stack track to the point where the message was sent. That is what I am currently trying to log :)


Avatar

Darren

Posted on
May 20 2014

Couldn't you simply throw a custom exception? The stack trace would then be included automatically. I know there might be extra overhead with an exception, and also program flow issues, but it seems the simplest solution.

Avatar

KendallB

Posted on
May 20 2014

We did that already; it does not contain the information we need

Avatar

steve

Posted on
Aug 07 2014

I second this request. There are certain circumstances where we want to be able to customize our stack traces and currently cannot.

I cannot get the code samples to format properly here so here is a link to an example:

https://gist.github.com/steve-torchia/96801fee770a04fd86f9

Avatar

martin308

Posted on
Aug 07 2014

Hi,

There is an event you can listen to on the Raygun client that will allow you to mutate the message before it is sent, will this accomplish what you need?

Avatar

steve

Posted on
Aug 07 2014

Only if it's the client-side RayGun code that is preventing the custom stack trace from being sent over the wire. My guess is that it's something they are doing server-side because the stack traces are used in their grouping algos. It's certainly worth a test to see if this issue can be worked-around via the SendingMessage event.

Avatar

martin308

Posted on
Aug 07 2014

We don't alter the stack trace server side just read it to do the grouping so you should be fine to mutate the stack trace in that event and we will use your custom stack trace to do the grouping

Avatar

steve

Posted on
Aug 07 2014

(sorry didn't realize you were a RayGun employee)

That's great news! It sounds like it will give us what we are looking for. Will try it out, thanks!

Avatar

martin308

Posted on
Aug 07 2014

No problem! Let me know if this does not work for you and we can look at doing something else

Avatar

steve

Posted on
Aug 13 2014

Yes this is what we needed. There are certain scenarios where we need to munge the stack trace payload and by building our own RaygunErrorMessage.StackTrace in the SendingMessage event handler we can easily achieve that.

Thanks for pointing this out

-steve

Avatar

steve

Posted on
Aug 15 2014

So after using this for a bit, there is one more thing we would like to be able to do inside that event handler. It would be nice if we were not ‘forced’ to supply values for all four of properties in the RayGunErrorStackTraceLineMessage class. I tried sending null for ClassName and FileName but it didn’t seem to work. The stack never appeared in the Summary Tab. So for now I’m just putting in underscores as placeholders. And LineNumber isn’t nullable so i’m just putting a zero.

     return new RaygunErrorStackTraceLineMessage()
        {
            ClassName = "_",   
            MethodName = frameData,
            FileName = "_", 
            LineNumber = 0, 
        };
Avatar

Raygun

Jason Fauchelle

Posted on
Aug 15 2014

Hello Steve

Thanks for pointing this out. The stack trace formatter was expecting both the class name and method name to be set. We've fixed this up right now so that you are not forced to set all the properties. The line number will still be displayed though, even if it is 0.

-Jason Fauchelle