Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Overwriting error stacktrace #17

Open
sitegui opened this issue Mar 22, 2020 · 3 comments
Open

Overwriting error stacktrace #17

sitegui opened this issue Mar 22, 2020 · 3 comments
Labels

Comments

@sitegui
Copy link

sitegui commented Mar 22, 2020

Hello,

For some context, we are in the process of evaluating New Relic for our new Rust projects. For that, we're using this C SDK along with the crate newrelic.

When using the function newrelic_notice_error(), a stack trace is internally generated with newrelic_get_stack_trace_as_json() and appears like so:

image

Naturally, all the Rust symbols are mangled and there is no mapping to source location (filename and line). We'd like to use the backtrace crate to capture the stacktrace from Rust, proving our developers a more familiar and readable feedback.

It is possible to overwrite the stacktrace today? I did a quick search of source code, but I could not find a way to do it.

If that is not possible, would it be a valid feature to add? Maybe other languages without a dedicated agent could also profit from this pattern of capturing native stack traces and passing it to the C SDK.

Best regards,

@pyohannes
Copy link

Hi Guilherme!

Great to see Rust apps reporting to New Relic. Unfortunately, the C SDK doesn't currently provide the possibility to use custom stack traces. At the moment the only way to do that would be by modifying the C SDK yourself (e. g., making newrelic_get_stack_trace_as_json a hook that can accept a user defined function).

If that is not possible, would it be a valid feature to add?

Yes, definitely. We will file an internal issue for this and keep you updated about the progress.

Thanks for using the C SDK.

@sitegui
Copy link
Author

sitegui commented Apr 27, 2020

Hello again,
thanks for the answer :)

I've implemented a sister function to newrelic_notice_error called newrelic_notice_error_with_stacktrace, that allows passing the stacktrace in the final (JSON) string format in this branch: master...sitegui:newrelic_notice_error_with_stacktrace

This works for our use case and we are no longer blocked by this feature request.

Would a PR with this change be welcomed?

Thanks

@pyohannes
Copy link

Hi Guilherme,

Yes, a PR with this change would be much appreciated! I already have an internal issue filed, I will link it to your PR and we'll evaluate your solution once we start working on this.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants