-
-
Notifications
You must be signed in to change notification settings - Fork 226
Map iOS Native BeforeSend & OnCrashedLastEvent to SentryOptions.Native #3958
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 4 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
a1b0cb6
Initial commit for exposing iOS native before send & crashed last run
aritchie 1a8474e
Initial feature set is working
aritchie c36be94
Format code
getsentry-bot cd074d4
Update CHANGELOG.md
aritchie 17790c7
Merge branch '2102-ios_beforesend_oncrashedlastrun' of https://github…
aritchie 70a677d
Merge signal abort code before user based BeforeSend
aritchie 4a6462c
Move native BeforeSend & OnCrashedLastRun events to SentryOptions - O…
aritchie 91145ab
Always run NativeOptions.BeforeSend so sig aborts can be filtered
aritchie fd48026
Update SentrySdk.cs
aritchie 1b3dfdd
Merge branch 'main' into 2102-ios_beforesend_oncrashedlastrun
aritchie c29a785
Update CHANGELOG.md
aritchie 50a5554
Format code
getsentry-bot 63e3f55
WIP - removing serialization mechanics as they cause a native crash d…
aritchie 5c06eb5
Transferring transformed sentryevent back to original native event in…
aritchie 18a1079
Merge branch 'main' into 2102-ios_beforesend_oncrashedlastrun
aritchie 000b324
Remove unnecessary hacks
aritchie bdfe3a9
Format code
getsentry-bot bf4d33d
Add missing bindable option for native iOS sentryoptions
aritchie 52f0699
Update SentrySdk.cs
aritchie dab118e
Update SentrySdk.cs
aritchie 1f721b8
Update CHANGELOG.md
aritchie 4830f8e
Update CHANGELOG.md
aritchie b8b08cc
Unit tests mapping checks to/from native iOS
aritchie a46bd43
Format code
getsentry-bot 5dca9e2
Update NativeSerializationTests.cs
aritchie 00cbc04
Revert "Add missing bindable option for native iOS sentryoptions"
aritchie d2776e1
Remove iOS native event suppress configuration
aritchie 5e8134a
Update CHANGELOG.md
aritchie d8ac6ea
Rename tests according to review
aritchie 63326ec
add timestamp for deserialize test
aritchie d1feffc
Account for fractions of seconds
aritchie 6c10867
Merge branch 'main' into 2102-ios_beforesend_oncrashedlastrun
aritchie ede88c1
Platforms should not change
aritchie bbf9da4
Update CocoaExtensionsTests.cs
aritchie 65534f0
Update CocoaExtensionsTests.cs
aritchie 35113e1
Update CocoaExtensionsTests.cs
aritchie 4c6d7a2
Update CocoaExtensionsTests.cs
aritchie e80ce73
Safety SentryLevel in both directions
aritchie e97bc47
Update EnumExtensions.cs
aritchie 61665c5
Format code
getsentry-bot 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
Submodule Ben.Demystifier
updated
13 files
Submodule sentry-native
updated
13 files
| +7 −1 | CHANGELOG.md | |
| +21 −3 | include/sentry.h | |
| +1 −1 | ndk/gradle.properties | |
| +3 −0 | ndk/lib/api/sentry-native-ndk.api | |
| +2 −0 | ndk/lib/src/main/java/io/sentry/ndk/INativeScope.java | |
| +11 −0 | ndk/lib/src/main/java/io/sentry/ndk/NativeScope.java | |
| +14 −1 | ndk/lib/src/main/jni/sentry.c | |
| +30 −0 | src/sentry_core.c | |
| +2 −2 | tests/assertions.py | |
| +1 −1 | tests/test_integration_http.py | |
| +113 −0 | tests/unit/test_tracing.c | |
| +4 −0 | tests/unit/tests.inc | |
| +1 −1 | tests/win_utils.py |
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 |
|---|---|---|
|
|
@@ -286,6 +286,24 @@ public void WriteTo(Utf8JsonWriter writer, IDiagnosticLogger? logger) | |
| /// </summary> | ||
| public static SentryEvent FromJson(JsonElement json) => FromJson(json, null); | ||
|
|
||
| private static SentryLevel? SafeLevelFromJson(JsonElement json) | ||
| { | ||
| var levelString = json.GetPropertyOrNull("level")?.GetString(); | ||
| if (levelString == null) | ||
| return null; | ||
|
|
||
| // Native SentryLevel.None does not exist in dotnet | ||
| return levelString.ToLowerInvariant() switch | ||
| { | ||
| "debug" => SentryLevel.Debug, | ||
| "info" => SentryLevel.Info, | ||
| "warning" => SentryLevel.Warning, | ||
| "fatal" => SentryLevel.Fatal, | ||
| "error" => SentryLevel.Error, | ||
| _ => null | ||
|
Collaborator
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. I take it this is intentional (we don't want to throw an exception but we can't conveniently log the irregularity anywhere)? |
||
| }; | ||
| } | ||
|
|
||
| internal static SentryEvent FromJson(JsonElement json, Exception? exception) | ||
| { | ||
| var modules = json.GetPropertyOrNull("modules")?.GetStringDictionaryOrNull(); | ||
|
|
@@ -299,7 +317,7 @@ internal static SentryEvent FromJson(JsonElement json, Exception? exception) | |
| var distribution = json.GetPropertyOrNull("dist")?.GetString(); | ||
| var exceptionValues = json.GetPropertyOrNull("exception")?.GetPropertyOrNull("values")?.EnumerateArray().Select(SentryException.FromJson).ToList().Pipe(v => new SentryValues<SentryException>(v)); | ||
| var threadValues = json.GetPropertyOrNull("threads")?.GetPropertyOrNull("values")?.EnumerateArray().Select(SentryThread.FromJson).ToList().Pipe(v => new SentryValues<SentryThread>(v)); | ||
| var level = json.GetPropertyOrNull("level")?.GetString()?.ParseEnum<SentryLevel>(); | ||
|
|
||
| var transaction = json.GetPropertyOrNull("transaction")?.GetString(); | ||
| var request = json.GetPropertyOrNull("request")?.Pipe(SentryRequest.FromJson); | ||
| var contexts = json.GetPropertyOrNull("contexts")?.Pipe(SentryContexts.FromJson); | ||
|
|
@@ -310,7 +328,7 @@ internal static SentryEvent FromJson(JsonElement json, Exception? exception) | |
| var breadcrumbs = json.GetPropertyOrNull("breadcrumbs")?.EnumerateArray().Select(Breadcrumb.FromJson).ToList(); | ||
| var extra = json.GetPropertyOrNull("extra")?.GetDictionaryOrNull(); | ||
| var tags = json.GetPropertyOrNull("tags")?.GetStringDictionaryOrNull(); | ||
|
|
||
| var level = SafeLevelFromJson(json); | ||
| var debugMeta = json.GetPropertyOrNull("debug_meta")?.Pipe(DebugMeta.FromJson); | ||
|
|
||
| return new SentryEvent(exception, timestamp, eventId) | ||
|
|
||
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
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.
Do we know what the behaviour of SentryLevel.None is? Does it mean nothing gets logged? Is that was setting the level = null does?