Skip to content

Commit

Permalink
Revert "feat(on-demand): Extend support fields in the event getter (#…
Browse files Browse the repository at this point in the history
…2640)"

This reverts commit 64a42ae.
  • Loading branch information
jan-auer authored Oct 23, 2023
1 parent 64a42ae commit 031e619
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 159 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
- Update Docker Debian image from 10 to 12. ([#2622](https://github.com/getsentry/relay/pull/2622))
- Remove event spans starting or ending before January 1, 1970 UTC. ([#2627](https://github.com/getsentry/relay/pull/2627))
- Remove event breadcrumbs dating before January 1, 1970 UTC. ([#2635](https://github.com/getsentry/relay/pull/2635))
- Extend the number of supported fields for the `Event` `Getter`. ([#2640](https://github.com/getsentry/relay/pull/2640))

**Internal**:

Expand Down
1 change: 0 additions & 1 deletion py/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
- Drop events starting or ending before January 1, 1970 UTC. ([#2613](https://github.com/getsentry/relay/pull/2613))
- Remove event spans starting or ending before January 1, 1970 UTC. ([#2627](https://github.com/getsentry/relay/pull/2627))
- Remove event breadcrumbs dating before January 1, 1970 UTC. ([#2635](https://github.com/getsentry/relay/pull/2635))
- Extend the number of supported fields for the `Event` `Getter`. ([#2640](https://github.com/getsentry/relay/pull/2640))

## 0.8.31

Expand Down
26 changes: 0 additions & 26 deletions relay-event-schema/src/protocol/contexts/device.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#[cfg(feature = "jsonschema")]
use relay_jsonschema_derive::JsonSchema;
use relay_protocol::{Annotated, Empty, FromValue, IntoValue, Object, Value};
use uuid::Uuid;

use crate::processor::ProcessValue;

Expand Down Expand Up @@ -162,22 +161,6 @@ pub struct DeviceContext {
/// Whether location support is available on the device.
pub supports_location_service: Annotated<bool>,

/// Width of the screen in pixels.
#[metastructure(pii = "maybe")]
pub screen_width_pixels: Annotated<u64>,

/// Height of the screen in pixels.
#[metastructure(pii = "maybe")]
pub screen_height_pixels: Annotated<u64>,

/// Locale of the device.
#[metastructure(pii = "maybe")]
pub locale: Annotated<String>,

/// UUID of the device.
#[metastructure(pii = "maybe")]
pub uuid: Annotated<Uuid>,

/// Additional arbitrary fields for forwards compatibility
#[metastructure(additional_properties, retain = "true", pii = "maybe")]
pub other: Object<Value>,
Expand Down Expand Up @@ -217,7 +200,6 @@ impl super::DefaultContext for DeviceContext {
#[cfg(test)]
mod tests {
use relay_protocol::{Annotated, Object, Value};
use uuid::uuid;

use super::*;
use crate::protocol::Context;
Expand Down Expand Up @@ -261,10 +243,6 @@ mod tests {
"supports_gyroscope": true,
"supports_audio": true,
"supports_location_service": true,
"screen_width_pixels": 1920,
"screen_height_pixels": 1080,
"locale": "US",
"uuid": "abadcade-feed-dead-beef-baddadfeeded",
"other": "value",
"type": "device"
}"#;
Expand Down Expand Up @@ -307,10 +285,6 @@ mod tests {
supports_gyroscope: Annotated::new(true),
supports_audio: Annotated::new(true),
supports_location_service: Annotated::new(true),
screen_width_pixels: Annotated::new(1920),
screen_height_pixels: Annotated::new(1080),
locale: Annotated::new("US".to_string()),
uuid: Annotated::new(uuid!("abadcade-feed-dead-beef-baddadfeeded")),
other: {
let mut map = Object::new();
map.insert(
Expand Down
93 changes: 1 addition & 92 deletions relay-event-schema/src/protocol/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,59 +650,16 @@ impl Getter for Event {
"user.geo.region" => self.user.value()?.geo.value()?.region.as_str()?.into(),
"user.geo.subdivision" => self.user.value()?.geo.value()?.subdivision.as_str()?.into(),
"request.method" => self.request.value()?.method.as_str()?.into(),
"sdk.name" => self.client_sdk.value()?.name.as_str()?.into(),
"sdk.version" => self.client_sdk.value()?.version.as_str()?.into(),

// Partial implementation of contexts.
"contexts.device.arch" => self.context::<DeviceContext>()?.arch.as_str()?.into(),
"contexts.device.battery_level" => self
.context::<DeviceContext>()?
.battery_level
.value()?
.into(),
"contexts.device.brand" => self.context::<DeviceContext>()?.brand.as_str()?.into(),
"contexts.device.charging" => self.context::<DeviceContext>()?.charging.value()?.into(),
"contexts.device.family" => self.context::<DeviceContext>()?.family.as_str()?.into(),
"contexts.device.locale" => self.context::<DeviceContext>()?.locale.as_str()?.into(),
"contexts.device.online" => self.context::<DeviceContext>()?.online.value()?.into(),
"contexts.device.orientation" => self
.context::<DeviceContext>()?
.orientation
.as_str()?
.into(),
"contexts.device.name" => self.context::<DeviceContext>()?.name.as_str()?.into(),
"contexts.device.screen_density" => self
.context::<DeviceContext>()?
.screen_density
.value()?
.into(),
"contexts.device.screen_dpi" => {
self.context::<DeviceContext>()?.screen_dpi.value()?.into()
}
"contexts.device.screen_width_pixels" => self
.context::<DeviceContext>()?
.screen_width_pixels
.value()?
.into(),
"contexts.device.screen_height_pixels" => self
.context::<DeviceContext>()?
.screen_height_pixels
.value()?
.into(),
"contexts.device.simulator" => {
self.context::<DeviceContext>()?.simulator.value()?.into()
}
"contexts.os.build" => self.context::<OsContext>()?.build.as_str()?.into(),
"contexts.os.kernel_version" => {
self.context::<OsContext>()?.kernel_version.as_str()?.into()
}
"contexts.device.family" => self.context::<DeviceContext>()?.family.as_str()?.into(),
"contexts.os.name" => self.context::<OsContext>()?.name.as_str()?.into(),
"contexts.os.version" => self.context::<OsContext>()?.version.as_str()?.into(),
"contexts.browser.name" => self.context::<BrowserContext>()?.name.as_str()?.into(),
"contexts.browser.version" => {
self.context::<BrowserContext>()?.version.as_str()?.into()
}
"contexts.device.uuid" => self.context::<DeviceContext>()?.uuid.value()?.into(),
"contexts.trace.status" => self
.context::<TraceContext>()?
.status
Expand Down Expand Up @@ -760,7 +717,6 @@ mod tests {
use chrono::{TimeZone, Utc};
use relay_protocol::{ErrorKind, Map, Meta};
use similar_asserts::assert_eq;
use uuid::uuid;

use super::*;
use crate::protocol::{Headers, IpAddr, JsonLenientString, PairList, TagEntry};
Expand Down Expand Up @@ -1042,11 +998,6 @@ mod tests {
segment: Annotated::new("user-seg".into()),
..Default::default()
}),
client_sdk: Annotated::new(ClientSdkInfo {
name: Annotated::new("sentry-javascript".into()),
version: Annotated::new("1.87.0".into()),
..Default::default()
}),
exceptions: Annotated::new(Values {
values: Annotated::new(vec![Annotated::new(Exception {
value: Annotated::new(JsonLenientString::from(
Expand Down Expand Up @@ -1077,12 +1028,6 @@ mod tests {
name: Annotated::new("iphone".to_string()),
family: Annotated::new("iphone-fam".to_string()),
model: Annotated::new("iphone7,3".to_string()),
screen_dpi: Annotated::new(560),
screen_width_pixels: Annotated::new(1920),
screen_height_pixels: Annotated::new(1080),
locale: Annotated::new("US".into()),
uuid: Annotated::new(uuid!("abadcade-feed-dead-beef-baddadfeeded")),
charging: Annotated::new(true),
..DeviceContext::default()
});
contexts.add(OsContext {
Expand Down Expand Up @@ -1134,42 +1079,6 @@ mod tests {
event.get_value("event.tags.custom")
);
assert_eq!(None, event.get_value("event.tags.doesntexist"));
assert_eq!(
Some(Val::String("sentry-javascript")),
event.get_value("event.sdk.name")
);
assert_eq!(
Some(Val::String("1.87.0")),
event.get_value("event.sdk.version")
);
assert_eq!(
Some(Val::String("17.4.0")),
event.get_value("event.contexts.os.kernel_version")
);
assert_eq!(
Some(Val::I64(560)),
event.get_value("event.contexts.device.screen_dpi")
);
assert_eq!(
Some(Val::Bool(true)),
event.get_value("event.contexts.device.charging")
);
assert_eq!(
Some(Val::U64(1920)),
event.get_value("event.contexts.device.screen_width_pixels")
);
assert_eq!(
Some(Val::U64(1080)),
event.get_value("event.contexts.device.screen_height_pixels")
);
assert_eq!(
Some(Val::String("US")),
event.get_value("event.contexts.device.locale")
);
assert_eq!(
Some(Val::Uuid(uuid!("abadcade-feed-dead-beef-baddadfeeded"))),
event.get_value("event.contexts.device.uuid")
);
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ expression: SerializableAnnotated(&event)
"external_free_storage": 534702080,
"boot_time": null,
"timezone": null,
"screen_width_pixels": null,
"screen_height_pixels": null,
"archs": [
"x86"
],
"screen_height_pixels": null,
"screen_width_pixels": null,
"type": "device"
},
"os": {
Expand Down
37 changes: 0 additions & 37 deletions relay-server/tests/snapshots/test_fixtures__event_schema.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1209,14 +1209,6 @@ expression: "relay_event_schema::protocol::event_json_schema()"
"format": "uint64",
"minimum": 0.0
},
"locale": {
"description": " Locale of the device.",
"default": null,
"type": [
"string",
"null"
]
},
"low_memory": {
"description": " Whether the device was low on memory.",
"default": null,
Expand Down Expand Up @@ -1322,16 +1314,6 @@ expression: "relay_event_schema::protocol::event_json_schema()"
"format": "uint64",
"minimum": 0.0
},
"screen_height_pixels": {
"description": " Height of the screen in pixels.",
"default": null,
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
},
"screen_resolution": {
"description": " Device screen resolution.\n\n (e.g.: 800x600, 3040x1444)",
"default": null,
Expand All @@ -1340,16 +1322,6 @@ expression: "relay_event_schema::protocol::event_json_schema()"
"null"
]
},
"screen_width_pixels": {
"description": " Width of the screen in pixels.",
"default": null,
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
},
"simulator": {
"description": " Simulator/prod indicator.",
"default": null,
Expand Down Expand Up @@ -1425,15 +1397,6 @@ expression: "relay_event_schema::protocol::event_json_schema()"
],
"format": "uint64",
"minimum": 0.0
},
"uuid": {
"description": " UUID of the device.",
"default": null,
"type": [
"string",
"null"
],
"format": "uuid"
}
},
"additionalProperties": false
Expand Down

0 comments on commit 031e619

Please sign in to comment.