Skip to content

Commit dba7030

Browse files
authored
feat(protocol): Add app.in_foreground and thread.main flag (#1578)
1 parent adbf8ff commit dba7030

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- Dynamic sampling is now based on the volume received by Relay by default and does not include the original volume dropped by client-side sampling in SDKs. This is required for the final dynamic sampling feature in the latest Sentry plans. ([#1591](https://github.com/getsentry/relay/pull/1591))
88
- Add OpenTelemetry Context ([#1617](https://github.com/getsentry/relay/pull/1617))
9+
- Add `app.in_foreground` and `thread.main` flag to protocol. ([#1578](https://github.com/getsentry/relay/pull/1578))
910

1011
**Internal**:
1112

relay-general/src/protocol/contexts/app.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ pub struct AppContext {
3636
/// Amount of memory used by the application in bytes.
3737
pub app_memory: Annotated<u64>,
3838

39+
/// A flag indicating whether the app is in foreground or not. An app is in foreground when it's visible to the user.
40+
pub in_foreground: Annotated<bool>,
41+
3942
/// Additional arbitrary fields for forwards compatibility.
4043
#[metastructure(additional_properties, retain = "true", pii = "maybe")]
4144
pub other: Object<Value>,
@@ -64,6 +67,7 @@ mod tests {
6467
"app_version": "1.0",
6568
"app_build": "100001",
6669
"app_memory": 22883948,
70+
"in_foreground": true,
6771
"other": "value",
6872
"type": "app"
6973
}"#;
@@ -76,6 +80,7 @@ mod tests {
7680
app_version: Annotated::new("1.0".to_string()),
7781
app_build: Annotated::new("100001".to_string().into()),
7882
app_memory: Annotated::new(22883948),
83+
in_foreground: Annotated::new(true),
7984
other: {
8085
let mut map = Object::new();
8186
map.insert(

relay-general/src/protocol/thread.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,12 @@ pub struct Thread {
119119
/// A flag indicating whether the thread crashed. Defaults to `false`.
120120
pub crashed: Annotated<bool>,
121121

122-
/// A flag indicating whether the thread was in the foreground. Defaults to `false`.
122+
/// A flag indicating whether the thread was in the foreground. Defaults to `false`.
123123
pub current: Annotated<bool>,
124124

125+
/// A flag indicating whether the thread was responsible for rendering the user interface.
126+
pub main: Annotated<bool>,
127+
125128
/// Additional arbitrary fields for forwards compatibility.
126129
#[metastructure(additional_properties)]
127130
pub other: Object<Value>,
@@ -165,6 +168,7 @@ mod tests {
165168
"name": "myname",
166169
"crashed": true,
167170
"current": true,
171+
"main": true,
168172
"other": "value"
169173
}"#;
170174
let thread = Annotated::new(Thread {
@@ -174,6 +178,7 @@ mod tests {
174178
raw_stacktrace: Annotated::empty(),
175179
crashed: Annotated::new(true),
176180
current: Annotated::new(true),
181+
main: Annotated::new(true),
177182
other: {
178183
let mut map = Map::new();
179184
map.insert(

relay-general/tests/snapshots/test_fixtures__event_schema.snap

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,14 @@ expression: "relay_general::protocol::event_json_schema()"
470470
"string",
471471
"null"
472472
]
473+
},
474+
"in_foreground": {
475+
"description": " A flag indicating whether the app is in foreground or not. An app is in foreground when it's visible to the user.",
476+
"default": null,
477+
"type": [
478+
"boolean",
479+
"null"
480+
]
473481
}
474482
},
475483
"additionalProperties": false
@@ -2935,7 +2943,7 @@ expression: "relay_general::protocol::event_json_schema()"
29352943
]
29362944
},
29372945
"current": {
2938-
"description": " A flag indicating whether the thread was in the foreground. Defaults to `false`.",
2946+
"description": " A flag indicating whether the thread was in the foreground. Defaults to `false`.",
29392947
"default": null,
29402948
"type": [
29412949
"boolean",
@@ -2954,6 +2962,14 @@ expression: "relay_general::protocol::event_json_schema()"
29542962
}
29552963
]
29562964
},
2965+
"main": {
2966+
"description": " A flag indicating whether the thread was responsible for rendering the user interface.",
2967+
"default": null,
2968+
"type": [
2969+
"boolean",
2970+
"null"
2971+
]
2972+
},
29572973
"name": {
29582974
"description": " Display name of this thread.",
29592975
"default": null,

0 commit comments

Comments
 (0)