-
-
Notifications
You must be signed in to change notification settings - Fork 214
fix(native): daemon constructs breadcrumbs from file #1775
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3c6fd49
refactor
bitsandfoxes a26c756
linter
bitsandfoxes 0668a93
restored default fatal behaviour
bitsandfoxes caeb8fb
fix naming
bitsandfoxes 0a3a646
perf(native): keep breadcrumbs off the per-mutation scope flush
bitsandfoxes 57af004
read breadcrumbs from ring file
bitsandfoxes 0a57db6
minified change
bitsandfoxes 64a1d71
merged scope changes
bitsandfoxes b157d91
minified changes here too
bitsandfoxes 1326bc5
bail with breadcrumbs disabled
bitsandfoxes 4fb6895
fixed serialization regression
bitsandfoxes 8a5a6be
fixed scope sync limit
bitsandfoxes 1533aa0
added tests
bitsandfoxes 419395b
merged master
bitsandfoxes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -309,6 +309,7 @@ native_backend_startup( | |
| ctx->http_retry = options->http_retry; | ||
| ctx->shutdown_timeout = options->shutdown_timeout; | ||
| ctx->transfer_timeout = options->transfer_timeout; | ||
| ctx->max_breadcrumbs = (uint32_t)options->max_breadcrumbs; | ||
| sentry__atomic_store( | ||
| &ctx->user_consent, sentry__atomic_fetch(&options->run->user_consent)); | ||
|
|
||
|
|
@@ -867,18 +868,20 @@ native_backend_add_breadcrumb(sentry_backend_t *backend, | |
| return; | ||
| } | ||
|
|
||
| // Serialize to JSON (so it can be deserialized on next start) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That comment is misleading, could not find who or what was reading the JSON on the next start. |
||
| size_t json_len = 0; | ||
| char *json_str = sentry__value_to_json(breadcrumb, &json_len); | ||
| if (!json_str) { | ||
| // Append as msgpack, matching the crashpad backend. msgpack values are | ||
| // self-delimiting, so the daemon can read the concatenated ring file back | ||
| // into a list via `sentry__value_from_msgpack`. | ||
| size_t mpack_size = 0; | ||
| char *mpack = sentry_value_to_msgpack(breadcrumb, &mpack_size); | ||
| if (!mpack) { | ||
| return; | ||
| } | ||
|
|
||
| int rv = first_breadcrumb | ||
| ? sentry__path_write_buffer(breadcrumb_file, json_str, json_len) | ||
| : sentry__path_append_buffer(breadcrumb_file, json_str, json_len); | ||
| ? sentry__path_write_buffer(breadcrumb_file, mpack, mpack_size) | ||
| : sentry__path_append_buffer(breadcrumb_file, mpack, mpack_size); | ||
|
|
||
| sentry_free(json_str); | ||
| sentry_free(mpack); | ||
|
|
||
| if (rv != 0) { | ||
| SENTRY_WARN("failed to write breadcrumb"); | ||
|
|
@@ -1011,10 +1014,11 @@ native_backend_except(sentry_backend_t *backend, const sentry_ucontext_t *uctx) | |
| } | ||
|
|
||
| if (should_handle) { | ||
| // Apply scope to event including breadcrumbs | ||
| // Apply scope to the event. The daemon assembles breadcrumbs | ||
| // from the ring files | ||
| SENTRY_WITH_SCOPE (scope) { | ||
| sentry__scope_apply_to_event( | ||
| scope, options, event, SENTRY_SCOPE_BREADCRUMBS); | ||
| scope, options, event, SENTRY_SCOPE_NONE); | ||
| } | ||
| #if defined(SENTRY_PLATFORM_WINDOWS) | ||
| ensure_device_arch(event); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it's the daemon now constructing the breadcrumbs from files it needs the
max_breadcrumbs.