Skip to content
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

End spans on crash and mark with error.crash.count: 1 #584

Open
stevoland opened this issue Jan 12, 2024 · 2 comments
Open

End spans on crash and mark with error.crash.count: 1 #584

stevoland opened this issue Jan 12, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@stevoland
Copy link
Contributor

Hi, this is a native request but I hope you don't mind me putting it here rather than cross-posting ios/android.

We're using the DdTrace API to collect spans to represent user journeys and generate latency/availability metrics. Currently there's a gap in the case of a native crash, the span isn't ended so the availability metric isn't accurate.

On a crash we would like open spans to be ended and marked with an attribute such as error.crash.count: 1.

Perhaps this could be achieved by either:

a) The native crash handler adding the attribute, ending the open spans and writing them to disk
b) Probably safer: writing open spans to disk on span start. If there's a crash report from the previous run read the started spans, add the attribute and end them (although the end timestamp would be inaccurate)

Thanks for your time!

@stevoland stevoland added the enhancement New feature or request label Jan 12, 2024
@louiszawadzki
Copy link
Contributor

Hi @stevoland, thanks for reaching out!

This is indeed not supported at the moment in the SDK. I've added tasks in our backlog to look at possible implementations on both platforms.

In the meantime, you can probably solve this on your end for RN crashes by implementing a custom error handler for JS crashes like we do in our SDK, closing all open spans before letting the app crash.

Let me know if that solved (even partially) your problem!

@stevoland
Copy link
Contributor Author

Thanks @louiszawadzki, appreciated.

We have indeed implemented a handler for JS side as you suggest. Seems to work well but fyi, found that we needed to add a short timeout before calling the previous handler to allow the spans to be written to disk. 10ms seems sufficient in my limited testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants