-
-
Notifications
You must be signed in to change notification settings - Fork 201
chore: SDK Truncation Logic #1347
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
7 commits
Select commit
Hold shift + click to select a range
cbf2c9d
no longer truncate tag value
JoshuaMoelans a67f658
restore span_set_tag truncation
JoshuaMoelans 2bd7d59
update MAX_ENVELOPE_ITEMS to only apply for sessions
JoshuaMoelans bdebd99
change envelope items to linked list
JoshuaMoelans be67a03
add attachments MAX_ENVELOPE_ITEMS test
JoshuaMoelans f5ce397
#define ATTACHMENT_COUNT
JoshuaMoelans b4fa10e
update CHANGELOG.md
JoshuaMoelans 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
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 |
|---|---|---|
|
|
@@ -453,3 +453,72 @@ SENTRY_TEST(attachments_bytes) | |
|
|
||
| sentry_close(); | ||
| } | ||
|
|
||
| #define ATTACHMENT_COUNT 15 | ||
|
|
||
| SENTRY_TEST(attachments_more_than_ten) | ||
| { | ||
| sentry_attachments_testdata_t testdata; | ||
| testdata.called = 0; | ||
| sentry__stringbuilder_init(&testdata.serialized_envelope); | ||
|
|
||
| SENTRY_TEST_OPTIONS_NEW(options); | ||
| sentry_options_set_auto_session_tracking(options, false); | ||
| sentry_options_set_dsn(options, "https://[email protected]/42"); | ||
| sentry_transport_t *transport | ||
| = sentry_transport_new(send_envelope_test_attachments); | ||
| sentry_transport_set_state(transport, &testdata); | ||
| sentry_options_set_transport(options, transport); | ||
|
|
||
| sentry_init(options); | ||
|
|
||
| // Create 15 unique attachment files (more than the old | ||
| // SENTRY_MAX_ENVELOPE_ITEMS of 10) to verify that the limit has been | ||
| // removed for attachments | ||
| sentry_path_t *attachment_paths[ATTACHMENT_COUNT]; | ||
| for (int i = 0; i < ATTACHMENT_COUNT; i++) { | ||
| char filename[64]; | ||
| snprintf(filename, sizeof(filename), | ||
| SENTRY_TEST_PATH_PREFIX ".attachment%d.txt", i); | ||
| attachment_paths[i] = sentry__path_from_str(filename); | ||
| sentry__path_write_buffer(attachment_paths[i], "content", 7); | ||
| sentry_attach_file(filename); | ||
| } | ||
|
|
||
| char message[128]; | ||
| snprintf(message, sizeof(message), "Event with %d attachments", | ||
| ATTACHMENT_COUNT); | ||
| sentry_capture_event( | ||
| sentry_value_new_message_event(SENTRY_LEVEL_INFO, "root", message)); | ||
|
|
||
| char *serialized | ||
| = sentry_stringbuilder_take_string(&testdata.serialized_envelope); | ||
|
|
||
| // Count the number of attachment items in the envelope | ||
| // Each attachment appears as: {"type":"attachment",...} | ||
| int attachment_count = 0; | ||
| const char *search_pos = serialized; | ||
| const char *pattern = "\"type\":\"attachment\""; | ||
| while ((search_pos = strstr(search_pos, pattern)) != NULL) { | ||
| attachment_count++; | ||
| search_pos += strlen(pattern); | ||
| } | ||
|
|
||
| // Verify we have all 15 attachments in the envelope | ||
| TEST_CHECK_INT_EQUAL(attachment_count, ATTACHMENT_COUNT); | ||
| // Verify the envelope also contains the event | ||
| TEST_CHECK(strstr(serialized, "\"type\":\"event\"") != NULL); | ||
| TEST_CHECK(strstr(serialized, message) != NULL); | ||
|
|
||
| sentry_free(serialized); | ||
|
|
||
| sentry_close(); | ||
|
|
||
| // Clean up all attachment files | ||
| for (int i = 0; i < ATTACHMENT_COUNT; i++) { | ||
| sentry__path_remove(attachment_paths[i]); | ||
| sentry__path_free(attachment_paths[i]); | ||
| } | ||
|
|
||
| TEST_CHECK_INT_EQUAL(testdata.called, 1); | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.