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

Usage questions #208

Closed
david-antiteum opened this issue Mar 31, 2020 · 6 comments · Fixed by #272
Closed

Usage questions #208

david-antiteum opened this issue Mar 31, 2020 · 6 comments · Fixed by #272

Comments

@david-antiteum
Copy link

Hi,

I´m adding sentry.native to an app and I have a few question:

  • I´m adding a breadcrumb when entering a method to add context (sentry_add_breadcrumb), can this breadcrumb be removed when exiting the method? Something like sentry_set_extra / sentry_remove_extra

  • I have enabled crashpad. The app starts and the db created. If I force a crash (1/0) it creates a dump but nothing is send to sentry.io. Do I need to setup my signal/exception handler? I saw case Handle Exception API #201 so, maybe, this is not yet ready

Thanks,

David

@Swatinem
Copy link
Member

  1. breadcrumbs can’t be removed, they are basically a list of prior events that happened leading up to a crash.
    What you would want is support for pushing/poping scopes, which we don’t support yet in the native SDK.

  2. have you correctly set up your DSN? since crashpad is an external process, it is a bit hard to tell what it actually does.

@david-antiteum
Copy link
Author

  1. Thanks. I will wait for scopes
  2. The DSN is fine, I´m pushing events to sentry.io. Also the logs shows activity:
[sentry] capturing event
[sentry] merging scope into event
[sentry] adding attachments to envelope
[sentry] sending envelope
[sentry] submitting task to background worker thread
[sentry] executing task on worker thread
[sentry] sending request using winhttp to ...

But, after forcing the crash, the app (in Windows, VC2019, sentry-native 0.2.2) just exits, no new log entry at all.

My options setup:

std::string my_dsn  = ...
std::string crashpad_app  = ...
std::string dumps_folder = ...

sentry_options_t *options = sentry_options_new();
sentry_options_set_dsn( options, my_dsn.c_str() );
sentry_options_set_release( options, fmt::format( "{}@{}.{}", app.name(), ASF_VERSION, ASF_GIT_HASH ).c_str() );
sentry_options_set_require_user_consent( options, SENTRY_USER_CONSENT_GIVEN );
if( app.config().used( "verbose" ) ){
	sentry_options_set_debug( options, 1 );
}
sentry_options_set_handler_path( options, crashpad_app.c_str() );
sentry_options_set_database_path( options, dumps_folder.c_str() ) );
sentry_init( options );

sentry_user_consent_give();

Thanks.

David

@Swatinem
Copy link
Member

The crashpad backend should also output quite some things to the log. What does it say?

@david-antiteum
Copy link
Author

When starting the app:

[sentry] starting transport
[sentry] starting background worker thread
[sentry] background worker thread started
[sentry] starting backend
[sentry] starting crashpad backend
[sentry] started crashpad client handler.

Nothing else.

If, instead of a crash I log and event, then I can see the activity, including the upload:

[sentry] capturing event
[sentry] merging scope into event
[sentry] adding attachments to envelope
[sentry] sending envelope
[sentry] submitting task to background worker thread
[sentry] executing task on worker thread
[sentry] sending request using winhttp to https://sentry.io:443/api/.../store/:
x-sentry-auth:Sentry sentry_key=..., sentry_version=7, sentry_client=sentry.native/0.2.2
content-type:application/json
content-length:23612

[sentry] Received Response:
HTTP/1.1 200 OK
Connection: keep-alive
Date: Tue, 31 Mar 2020 12:44:02 GMT
Content-Length: 41
Content-Type: application/json
Server: nginx
Vary: Origin
access-control-expose-headers: x-sentry-error, retry-after, x-sentry-rate-limits
x-envoy-upstream-service-time: 2
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

Thanks,

David

@daxpedda
Copy link
Contributor

daxpedda commented Jun 3, 2020

std::string my_dsn  = ...
std::string crashpad_app  = ...
std::string dumps_folder = ...

sentry_options_t *options = sentry_options_new();
sentry_options_set_dsn( options, my_dsn.c_str() );
sentry_options_set_release( options, fmt::format( "{}@{}.{}", app.name(), ASF_VERSION, ASF_GIT_HASH ).c_str() );
sentry_options_set_require_user_consent( options, SENTRY_USER_CONSENT_GIVEN );
if( app.config().used( "verbose" ) ){
	sentry_options_set_debug( options, 1 );
}
sentry_options_set_handler_path( options, crashpad_app.c_str() );
sentry_options_set_database_path( options, dumps_folder.c_str() ) );
sentry_init( options );

sentry_user_consent_give();

While trying out very minimal examples I too stumbled on this: no issue would show up on sentry.io.

In the end I discovered that it works if I make at least one "significant thing", like using sentry_set_extra or sentry_set_level.
So just adding sentry_set_level(SENTRY_LEVEL_WARNING); before a crash for example would make my minimal examples work.

@Swatinem
Copy link
Member

Swatinem commented Jun 3, 2020

In the end I discovered that it works if I make at least one "significant thing"

oohhhhh, this actually helps me a lot! This means that we don’t serialize the state when starting the backend, but only when there are changes to the scope.

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 a pull request may close this issue.

3 participants