-
-
Notifications
You must be signed in to change notification settings - Fork 174
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
Changing attachments after sentry_init
#586
Comments
Well, in theory, you could do that. But 1) its not threadsafe that way, 2) you can’t remove files after you added them. There was #433 but that stalled because there were concerns about the API design and how it fits into other language SDKs. |
sentry_init
@Swatinem Thanks for the confirmation. |
Also as that PR notes, the way that the crashpad backend works, the attachments in that case indeed are fixed at the time you start the backend, and they can’t be changed after the fact (without an unreasonable amount of effort to add that ability to crashpad). |
Just wanted to add my plus one to this, since I'm discovering the same thing, and also wanting to have the ability to change attachments at runtime. As we're building https://github.com/thebrowsercompany/swift-sentry we want to mirror the Cocoa APIs to have a somewhat drop in replacement. I was a bit confused when I saw that adding an attachment required a After reading the comments available on #433 it's unclear what API concerns still exist, or what is blocking it (other than the questions that exist which have no reply). It would be exceptional to have this API! |
Hi @brianmichel, the API concerns are mostly related to downstream SDKs that include the Native SDK to handle crashes on the "native" layer. Those SDKs must provide attachments via "byte-arrays" (in addition to lazily loaded paths). Since the PR was created in response to the needs of downstream SDKs, this still needs to be solved. The more significant issue for users of our crashpad backend is that the Of course, changing this in crashpad is an option, but it would require a cross-platform IPC mechanism that we'd have to introduce between the client and the handler, which increases the maintenance effort of our fork considerably. Last but not least, there are currently minimal resources available to work on new features of the Native SDK, so I cannot say when topics like these will get prioritized again. Because it wasn't mentioned in this issue yet, the current workaround on the sentry-native side is the following:
|
Description
I'm reading the source of Sentry SDK, and I see a comment relate using
sentry_options_t *options
.My application need to attach the log file when a crash occurs. My logger works like
unix logrotate
, it will generate a new file every day or when the file size exceeds a limit. Then I need to update the new log file path viasentry_options_add_attachment
so I understand this function will change theoptions object
.So can I use
sentry_options_add_attachment
aftersentry_init
and is it safe ?As I tested this way Sentry still work well.
The text was updated successfully, but these errors were encountered: