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

feat: API to add a stack trace to an exception or thread #723

Merged
merged 6 commits into from
Jun 14, 2022

Conversation

supervacuus
Copy link
Collaborator

@supervacuus supervacuus commented Jun 2, 2022

Proposal for #721

include/sentry.h Outdated
/**
* Adds a Stack Trace conforming to the Stack Trace Interface to a value.
*
* The value needs to be either an exception event, or a thread object.
Copy link
Member

Choose a reason for hiding this comment

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

An exception event object, or an exception object (not event)? The implementation assumes the latter, which also makes more sense.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are right, it should be

The value needs to be either an exception or a thread object.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How do you typically proceed with open conversations? I usually wait until the reviewer thinks the comment has been addressed in a follow-up commit, signaling by resolving.

@supervacuus
Copy link
Collaborator Author

Hi @jan-auer and @Swatinem, here are a few points to consider before I would make this a non-draft PR:

sentry-native with this PR has 3 functions in the public interface concerned with creating and attaching stack traces to values (i.e. excluding the actual unwinding- and the option/configuration interfaces):

Given the similarity of the latter two, I wondered whether there is a customer use case where the call-site will create a sentry_value_t from a stack trace and then doesn't immediately attach it to an exception or thread object? Would you prefer for this API to tend towards completeness (giving customers more freedom to handle values) or to reduce the chance of creating incoherent (for the backend) value structures?

Is the behavior inherited by sentry_value_set_key in case a "stacktrace" key is already present in the value argument acceptable, or should something more involved happen?

Depending a bit on the last question should the function be called sentry_value_attach_stacktrace or sentry_value_set_stacktrace (or some other name) instead of sentry_value_add_stacktrace?

@Swatinem
Copy link
Member

Swatinem commented Jun 9, 2022

I don’t really have a strong opinion on this. The API generally gives more freedom (and with great power comes great responsibility)

As for naming, maybe sentry_value_set_stacktrace is a better name indeed. If you want to make things a bit more clearer, you could as well make two (internally identical) functions sentry_exception_set_stacktrace and sentry_thread_set_stacktrace.

@supervacuus
Copy link
Collaborator Author

At this point, I am mostly trying to synchronize with the API idea for sentry-native that you folks have. Thanks for the feedback.

@supervacuus supervacuus marked this pull request as ready for review June 9, 2022 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants