diff --git a/CHANGELOG.md b/CHANGELOG.md index dbdde9a1cd..6b8de22572 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +**Breaking Changes**: +- Flatten Linux distribution fields into `os.context`([#4292](https://github.com/getsentry/relay/pull/4292)) + **Bug Fixes**: - Terminate the process when one of the services crashes. ([#4249](https://github.com/getsentry/relay/pull/4249)) diff --git a/py/CHANGELOG.md b/py/CHANGELOG.md index 7857e13d89..425e057025 100644 --- a/py/CHANGELOG.md +++ b/py/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## Unreleased + +**Breaking Changes**: +- Flatten Linux distribution fields into `os.context`([#4292](https://github.com/getsentry/relay/pull/4292)) + ## 0.9.3 - Add computed contexts for `os`, `browser` and `runtime` during normalization. ([#4239](https://github.com/getsentry/relay/pull/4239)) diff --git a/relay-event-normalization/src/normalize/user_agent.rs b/relay-event-normalization/src/normalize/user_agent.rs index b480e95b54..b2a31a4657 100644 --- a/relay-event-normalization/src/normalize/user_agent.rs +++ b/relay-event-normalization/src/normalize/user_agent.rs @@ -962,7 +962,9 @@ mod tests { build: ~, kernel_version: ~, rooted: ~, - distribution: ~, + distribution_name: ~, + distribution_version: ~, + distribution_pretty_name: ~, raw_description: ~, other: {}, } @@ -1035,7 +1037,9 @@ mod tests { build: ~, kernel_version: ~, rooted: ~, - distribution: ~, + distribution_name: ~, + distribution_version: ~, + distribution_pretty_name: ~, raw_description: ~, other: {}, } diff --git a/relay-event-schema/src/protocol/contexts/os.rs b/relay-event-schema/src/protocol/contexts/os.rs index c913f36ef9..66b4e4c315 100644 --- a/relay-event-schema/src/protocol/contexts/os.rs +++ b/relay-event-schema/src/protocol/contexts/os.rs @@ -32,8 +32,12 @@ pub struct OsContext { pub rooted: Annotated, /// Meta-data for the Linux Distribution. - #[metastructure(skip_serialization = "empty")] - pub distribution: Annotated, + #[metastructure(pii = "maybe")] + pub distribution_name: Annotated, + #[metastructure(pii = "maybe")] + pub distribution_version: Annotated, + #[metastructure(pii = "maybe")] + pub distribution_pretty_name: Annotated, /// Unprocessed operating system info. /// @@ -48,28 +52,6 @@ pub struct OsContext { pub other: Object, } -/// Metadata for the Linux Distribution. -#[derive(Clone, Debug, Default, PartialEq, Empty, FromValue, IntoValue, ProcessValue)] -pub struct LinuxDistribution { - /// An index-able name that is stable for each distribution. - pub name: Annotated, - /// The version of the distribution (missing in distributions with solely rolling release). - #[metastructure(skip_serialization = "empty")] - pub version: Annotated, - /// A full rendering of name + version + release name (not available in all distributions). - #[metastructure(skip_serialization = "empty")] - pub pretty_name: Annotated, - - /// Additional arbitrary fields for forwards compatibility. - #[metastructure( - additional_properties, - retain = "true", - pii = "maybe", - skip_serialization = "empty" - )] - pub other: Object, -} - impl super::DefaultContext for OsContext { fn default_key() -> &'static str { "os" @@ -127,7 +109,9 @@ mod tests { kernel_version: Annotated::new("17.4.0".to_string()), rooted: Annotated::new(true), raw_description: Annotated::new("iOS 11.4.2 FEEDFACE (17.4.0)".to_string()), - distribution: Annotated::empty(), + distribution_name: Annotated::empty(), + distribution_version: Annotated::empty(), + distribution_pretty_name: Annotated::empty(), other: { let mut map = Object::new(); map.insert( @@ -144,16 +128,14 @@ mod tests { #[test] fn test_os_context_linux_roundtrip() { - let json = r#"{ + let json: &str = r#"{ "os": "Linux 5.15.133", "name": "Linux", "version": "5.15.133", "build": "1-microsoft-standard-WSL2", - "distribution": { - "name": "ubuntu", - "version": "22.04", - "pretty_name": "Ubuntu 22.04.4 LTS" - }, + "distribution_name": "ubuntu", + "distribution_version": "22.04", + "distribution_pretty_name": "Ubuntu 22.04.4 LTS", "type": "os" }"#; let context = Annotated::new(Context::Os(Box::new(OsContext { @@ -164,12 +146,9 @@ mod tests { kernel_version: Annotated::empty(), rooted: Annotated::empty(), raw_description: Annotated::empty(), - distribution: Annotated::new(LinuxDistribution { - name: Annotated::new("ubuntu".to_string()), - version: Annotated::new("22.04".to_string()), - pretty_name: Annotated::new("Ubuntu 22.04.4 LTS".to_string()), - other: Object::default(), - }), + distribution_name: Annotated::new("ubuntu".to_string()), + distribution_version: Annotated::new("22.04".to_string()), + distribution_pretty_name: Annotated::new("Ubuntu 22.04.4 LTS".to_string()), other: Object::default(), }))); diff --git a/relay-server/tests/snapshots/test_fixtures__event_schema.snap b/relay-server/tests/snapshots/test_fixtures__event_schema.snap index 1968ab231f..d22726d9c5 100644 --- a/relay-server/tests/snapshots/test_fixtures__event_schema.snap +++ b/relay-server/tests/snapshots/test_fixtures__event_schema.snap @@ -2149,41 +2149,6 @@ expression: "relay_event_schema::protocol::event_json_schema()" "fatal" ] }, - "LinuxDistribution": { - "description": " Metadata for the Linux Distribution.", - "anyOf": [ - { - "type": "object", - "properties": { - "name": { - "description": " An index-able name that is stable for each distribution.", - "default": null, - "type": [ - "string", - "null" - ] - }, - "pretty_name": { - "description": " A full rendering of name + version + release name (not available in all distributions).", - "default": null, - "type": [ - "string", - "null" - ] - }, - "version": { - "description": " The version of the distribution (missing in distributions with solely rolling release).", - "default": null, - "type": [ - "string", - "null" - ] - } - }, - "additionalProperties": false - } - ] - }, "LockReason": { "description": " Represents an instance of a held lock (java monitor object) in a thread.", "anyOf": [ @@ -2770,16 +2735,28 @@ expression: "relay_event_schema::protocol::event_json_schema()" "null" ] }, - "distribution": { - "description": " Meta-data for the Linux Distribution.", + "distribution_name": { + "description": " An index-able name that is stable for each distribution.", "default": null, - "anyOf": [ - { - "$ref": "#/definitions/LinuxDistribution" - }, - { - "type": "null" - } + "type": [ + "string", + "null" + ] + }, + "distribution_version": { + "description": " The version of the distribution (missing in distributions with solely rolling release).", + "default": null, + "type": [ + "string", + "null" + ] + }, + "distribution_pretty_name": { + "description": " A full rendering of name + version + release name (not available in all distributions).", + "default": null, + "type": [ + "string", + "null" ] }, "kernel_version": {