Skip to content

Commit

Permalink
feat(schema): Add view_names to AppContext (#2344)
Browse files Browse the repository at this point in the history
Adds the `view_names` property to `AppContext`, so clients can send
which screen (or multiple screens) are visible to the user during an
event.

Relates to getsentry/sentry-dart#1545

---------

Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>
  • Loading branch information
denrase and marandaneto authored Sep 4, 2023
1 parent d6e110b commit c5834bf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

**Features**:

- Add `view_names` to `AppContext` ([#2344](https://github.com/getsentry/relay/pull/2344))
- Tag keys in error events and transaction events can now be up to `200` ASCII characters long. Before, tag keys were limited to 32 characters. ([#2453](https://github.com/getsentry/relay/pull/2453))

**Bug Fixes**:
Expand Down Expand Up @@ -115,7 +116,7 @@
- Use different error message for empty strings in schema processing. ([#2151](https://github.com/getsentry/relay/pull/2151))
- Filter irrelevant webkit-issues. ([#2088](https://github.com/getsentry/relay/pull/2088))

- Relay now supports a simplified cron check-in API. ([#2153](https://github.com/getsentry/relay/pull/2153))
- Relay now supports a simplified cron check-in API. ([#2153](https://github.com/getsentry/relay/pull/2153))

## 23.5.1

Expand Down
12 changes: 12 additions & 0 deletions relay-event-schema/src/protocol/contexts/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ pub struct AppContext {
/// A flag indicating whether the app is in foreground or not. An app is in foreground when it's visible to the user.
pub in_foreground: Annotated<bool>,

/// The names of the currently visible views.
#[metastructure(skip_serialization = "empty")]
pub view_names: Annotated<Vec<Annotated<String>>>,

/// Additional arbitrary fields for forwards compatibility.
#[metastructure(additional_properties, retain = "true", pii = "maybe")]
pub other: Object<Value>,
Expand Down Expand Up @@ -96,6 +100,10 @@ mod tests {
"app_build": "100001",
"app_memory": 22883948,
"in_foreground": true,
"view_names": [
"FooViewController",
"BarViewController"
],
"other": "value",
"type": "app"
}"#;
Expand All @@ -109,6 +117,10 @@ mod tests {
app_build: Annotated::new("100001".to_string().into()),
app_memory: Annotated::new(22883948),
in_foreground: Annotated::new(true),
view_names: Annotated::new(vec![
Annotated::new("FooViewController".to_string()),
Annotated::new("BarViewController".to_string()),
]),
other: {
let mut map = Object::new();
map.insert(
Expand Down
14 changes: 14 additions & 0 deletions relay-server/tests/snapshots/test_fixtures__event_schema.snap
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,20 @@ expression: "relay_event_schema::protocol::event_json_schema()"
"boolean",
"null"
]
},
"view_names": {
"description": " The names of the currently visible views.",
"default": null,
"type": [
"array",
"null"
],
"items": {
"type": [
"string",
"null"
]
}
}
},
"additionalProperties": false
Expand Down

0 comments on commit c5834bf

Please sign in to comment.