diff --git a/CHANGELOG.md b/CHANGELOG.md index 9311cb4ebe..a632728186 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,6 @@ ## Unreleased -**Internal**: - -- Add BufferService with SQLite backend. ([#1920](https://github.com/getsentry/relay/pull/1920)) -- Adds iPad support for device.class synthesis in light normalization. ([#2008](https://github.com/getsentry/relay/pull/2008)) - **Breaking Changes**: This release contains major changes to the web layer, including TCP and HTTP handling as well as all web endpoint handlers. Due to these changes, some functionality was retired and Relay responds differently in specific cases. @@ -37,12 +32,15 @@ Metrics: - Don't sanitize transactions if no clustering rules exist and no UUIDs were scrubbed. ([#1976](https://github.com/getsentry/relay/pull/1976)) - Add `thread.lock_mechanism` field to protocol. ([#1979](https://github.com/getsentry/relay/pull/1979)) - Add `origin` to trace context and span. ([#1984](https://github.com/getsentry/relay/pull/1984)) +- Add new `mechanism` fields to protocol to support exception groups. ([#2020](https://github.com/getsentry/relay/pull/2020)) **Internal**: +- Add BufferService with SQLite backend. ([#1920](https://github.com/getsentry/relay/pull/1920)) - Upgrade the web framework and related dependencies. ([#1938](https://github.com/getsentry/relay/pull/1938)) - Apply transaction clustering rules before UUID scrubbing rules. ([#1964](https://github.com/getsentry/relay/pull/1964)) - Use exposed device-class-synthesis feature flag to gate device.class synthesis in light normalization. ([#1974](https://github.com/getsentry/relay/pull/1974)) +- Adds iPad support for device.class synthesis in light normalization. ([#2008](https://github.com/getsentry/relay/pull/2008)) - Pin schemars dependency to un-break schema docs generation. ([#2014](https://github.com/getsentry/relay/pull/2014)) ## 23.3.1 diff --git a/relay-general/src/protocol/mechanism.rs b/relay-general/src/protocol/mechanism.rs index 3b4032cee9..aeb253f13b 100644 --- a/relay-general/src/protocol/mechanism.rs +++ b/relay-general/src/protocol/mechanism.rs @@ -144,6 +144,48 @@ pub struct Mechanism { /// as the user explicitly captured the exception (and therefore kind of handled it) pub handled: Annotated, + /// An optional string value describing the source of the exception. + /// + /// For chained exceptions, this should contain the platform-specific name of the property or + /// attribute (on the parent exception) that this exception was acquired from. In the case of + /// an array, it should include the zero-based array index as well. + /// + /// - Python Examples: `"__context__"`, `"__cause__"`, `"exceptions[0]"`, `"exceptions[1]"` + /// + /// - .NET Examples: `"InnerException"`, `"InnerExceptions[0]"`, `"InnerExceptions[1]"` + /// + /// - JavaScript Examples: `"cause"`, `"errors[0]"`, `"errors[1]"` + #[metastructure( + required = "false", + nonempty = "true", + max_chars = "enumlike", + deny_chars = " \t\r\n" + )] + pub source: Annotated, + + /// An optional boolean value, set `true` when the exception is the platform-specific exception + /// group type. Defaults to `false`. + /// + /// For example, exceptions of type `ExceptionGroup` (Python), `AggregateException` (.NET), and + /// `AggregateError` (JavaScript) should have `"is_exception_group": true`. Other exceptions + /// can omit this field. + pub is_exception_group: Annotated, + + /// An optional numeric value providing an ID for the exception relative to this specific event. + /// It is referenced by the `parent_id` to reconstruct the logical tree of exceptions in an + /// exception group. + /// + /// This should contain an unsigned integer value starting with `0` for the last exception in + /// the exception values list, then `1` for the previous exception, etc. + pub exception_id: Annotated, + + /// An optional numeric value pointing at the `exception_id` that is the direct parent of this + /// exception, used to reconstruct the logical tree of exceptions in an exception group. + /// + /// The last exception in the exception values list should omit this field, because it is the + /// root exception and thus has no parent. + pub parent_id: Annotated, + /// Arbitrary extra data that might help the user understand the error thrown by this mechanism. #[metastructure(pii = "true", bag_size = "medium")] #[metastructure(skip_serialization = "empty")] @@ -168,6 +210,10 @@ impl FromValue for Mechanism { pub description: Annotated, pub help_link: Annotated, pub handled: Annotated, + pub source: Annotated, + pub is_exception_group: Annotated, + pub exception_id: Annotated, + pub parent_id: Annotated, pub data: Annotated>, pub meta: Annotated, #[metastructure(additional_properties)] @@ -210,6 +256,10 @@ impl FromValue for Mechanism { description: mechanism.description, help_link: mechanism.help_link, handled: mechanism.handled, + source: mechanism.source, + is_exception_group: mechanism.is_exception_group, + exception_id: mechanism.exception_id, + parent_id: mechanism.parent_id, data: mechanism.data, meta: mechanism.meta, other: mechanism.other, @@ -222,6 +272,10 @@ impl FromValue for Mechanism { description: Annotated::empty(), help_link: Annotated::empty(), handled: Annotated::empty(), + source: Annotated::empty(), + is_exception_group: Annotated::empty(), + exception_id: Annotated::empty(), + parent_id: Annotated::empty(), data: Annotated::new(legacy.other), meta: Annotated::new(MechanismMeta { errno: Annotated::empty(), @@ -270,6 +324,10 @@ mod tests { "description": "mydescription", "help_link": "https://developer.apple.com/library/content/qa/qa1367/_index.html", "handled": false, + "source": "errors[0]", + "is_exception_group": false, + "exception_id": 1, + "parent_id": 0, "data": { "relevant_address": "0x1" }, @@ -306,6 +364,10 @@ mod tests { "https://developer.apple.com/library/content/qa/qa1367/_index.html".to_string(), ), handled: Annotated::new(false), + source: Annotated::new("errors[0]".to_string()), + is_exception_group: Annotated::new(false), + exception_id: Annotated::new(1), + parent_id: Annotated::new(0), data: { let mut map = Map::new(); map.insert( @@ -420,6 +482,10 @@ mod tests { description: Annotated::empty(), help_link: Annotated::empty(), handled: Annotated::empty(), + source: Annotated::empty(), + is_exception_group: Annotated::empty(), + exception_id: Annotated::empty(), + parent_id: Annotated::empty(), data: { let mut map = Map::new(); map.insert( diff --git a/relay-general/tests/snapshots/test_fixtures__event_schema.snap b/relay-general/tests/snapshots/test_fixtures__event_schema.snap index b49ec1e491..315242a4ad 100644 --- a/relay-general/tests/snapshots/test_fixtures__event_schema.snap +++ b/relay-general/tests/snapshots/test_fixtures__event_schema.snap @@ -2209,6 +2209,16 @@ expression: "relay_general::protocol::event_json_schema()" "null" ] }, + "exception_id": { + "description": " An optional numeric value providing an ID for the exception relative to this specific event.\n It is referenced by the `parent_id` to reconstruct the logical tree of exceptions in an\n exception group.\n\n This should contain an unsigned integer value starting with `0` for the last exception in\n the exception values list, then `1` for the previous exception, etc.", + "default": null, + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, "handled": { "description": " Flag indicating whether this exception was handled.\n\n This is a best-effort guess at whether the exception was handled by user code or not. For\n example:\n\n - Exceptions leading to a 500 Internal Server Error or to a hard process crash are\n `handled=false`, as the SDK typically has an integration that automatically captures the\n error.\n\n - Exceptions captured using `capture_exception` (called from user code) are `handled=true`\n as the user explicitly captured the exception (and therefore kind of handled it)", "default": null, @@ -2225,6 +2235,14 @@ expression: "relay_general::protocol::event_json_schema()" "null" ] }, + "is_exception_group": { + "description": " An optional boolean value, set `true` when the exception is the platform-specific exception\n group type. Defaults to `false`.\n\n For example, exceptions of type `ExceptionGroup` (Python), `AggregateException` (.NET), and\n `AggregateError` (JavaScript) should have `\"is_exception_group\": true`. Other exceptions\n can omit this field.", + "default": null, + "type": [ + "boolean", + "null" + ] + }, "meta": { "description": " Operating system or runtime meta information.", "default": null, @@ -2237,6 +2255,24 @@ expression: "relay_general::protocol::event_json_schema()" } ] }, + "parent_id": { + "description": " An optional numeric value pointing at the `exception_id` that is the direct parent of this\n exception, used to reconstruct the logical tree of exceptions in an exception group.\n\n The last exception in the exception values list should omit this field, because it is the\n root exception and thus has no parent.", + "default": null, + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "source": { + "description": " An optional string value describing the source of the exception.\n\n For chained exceptions, this should contain the platform-specific name of the property or\n attribute (on the parent exception) that this exception was acquired from. In the case of\n an array, it should include the zero-based array index as well.\n\n - Python Examples: `\"__context__\"`, `\"__cause__\"`, `\"exceptions[0]\"`, `\"exceptions[1]\"`\n\n - .NET Examples: `\"InnerException\"`, `\"InnerExceptions[0]\"`, `\"InnerExceptions[1]\"`\n\n - JavaScript Examples: `\"cause\"`, `\"errors[0]\"`, `\"errors[1]\"`", + "default": null, + "type": [ + "string", + "null" + ] + }, "synthetic": { "description": " If this is set then the exception is not a real exception but some\n form of synthetic error for instance from a signal handler, a hard\n segfault or similar where type and value are not useful for grouping\n or display purposes.", "default": null,