@@ -11,10 +11,11 @@ use uuid::Uuid;
11
11
use crate :: processor:: ProcessValue ;
12
12
use crate :: protocol:: {
13
13
AppContext , Breadcrumb , Breakdowns , BrowserContext , ClientSdkInfo , Contexts , Csp , DebugMeta ,
14
- DefaultContext , DeviceContext , EventType , Exception , ExpectCt , ExpectStaple , Fingerprint , Hpkp ,
15
- LenientString , Level , LogEntry , Measurements , Metrics , MetricsSummary , OsContext ,
16
- ProfileContext , RelayInfo , Request , ResponseContext , Span , SpanId , Stacktrace , Tags ,
17
- TemplateInfo , Thread , Timestamp , TraceContext , TransactionInfo , User , Values ,
14
+ DefaultContext , DeviceContext , EventType , Exception , ExpectCt , ExpectStaple , Fingerprint ,
15
+ GpuContext , Hpkp , LenientString , Level , LogEntry , Measurements , Metrics , MetricsSummary ,
16
+ MonitorContext , OsContext , ProfileContext , RelayInfo , Request , ResponseContext , RuntimeContext ,
17
+ Span , SpanId , Stacktrace , Tags , TemplateInfo , Thread , Timestamp , TraceContext , TransactionInfo ,
18
+ User , Values ,
18
19
} ;
19
20
20
21
/// Wrapper around a UUID with slightly different formatting.
@@ -674,6 +675,11 @@ impl Getter for Event {
674
675
"contexts.app.in_foreground" => {
675
676
self . context :: < AppContext > ( ) ?. in_foreground . value ( ) ?. into ( )
676
677
}
678
+ "contexts.app.device_app_hash" => self
679
+ . context :: < AppContext > ( ) ?
680
+ . device_app_hash
681
+ . as_str ( ) ?
682
+ . into ( ) ,
677
683
"contexts.device.arch" => self . context :: < DeviceContext > ( ) ?. arch . as_str ( ) ?. into ( ) ,
678
684
"contexts.device.battery_level" => self
679
685
. context :: < DeviceContext > ( ) ?
@@ -713,12 +719,23 @@ impl Getter for Event {
713
719
"contexts.device.simulator" => {
714
720
self . context :: < DeviceContext > ( ) ?. simulator . value ( ) ?. into ( )
715
721
}
722
+ "contexts.gpu.vendor_name" => {
723
+ self . context :: < GpuContext > ( ) ?. vendor_name . as_str ( ) ?. into ( )
724
+ }
725
+ "contexts.gpu.name" => self . context :: < GpuContext > ( ) ?. name . as_str ( ) ?. into ( ) ,
726
+ "contexts.monitor.id" => self . context :: < MonitorContext > ( ) ?. get ( "id" ) ?. value ( ) ?. into ( ) ,
727
+ "contexts.monitor.slug" => self
728
+ . context :: < MonitorContext > ( ) ?
729
+ . get ( "slug" ) ?
730
+ . value ( ) ?
731
+ . into ( ) ,
716
732
"contexts.os.build" => self . context :: < OsContext > ( ) ?. build . as_str ( ) ?. into ( ) ,
717
733
"contexts.os.kernel_version" => {
718
734
self . context :: < OsContext > ( ) ?. kernel_version . as_str ( ) ?. into ( )
719
735
}
720
736
"contexts.os.name" => self . context :: < OsContext > ( ) ?. name . as_str ( ) ?. into ( ) ,
721
737
"contexts.os.version" => self . context :: < OsContext > ( ) ?. version . as_str ( ) ?. into ( ) ,
738
+ "contexts.os.rooted" => self . context :: < OsContext > ( ) ?. rooted . value ( ) ?. into ( ) ,
722
739
"contexts.browser.name" => self . context :: < BrowserContext > ( ) ?. name . as_str ( ) ?. into ( ) ,
723
740
"contexts.browser.version" => {
724
741
self . context :: < BrowserContext > ( ) ?. version . as_str ( ) ?. into ( )
@@ -746,6 +763,7 @@ impl Getter for Event {
746
763
super :: Context :: Other ( context) => context. get ( "crash_type" ) ?. value ( ) ?. into ( ) ,
747
764
_ => return None ,
748
765
} ,
766
+ "contexts.runtime.name" => self . context :: < RuntimeContext > ( ) ?. name . as_str ( ) ?. into ( ) ,
749
767
750
768
// Computed fields (see Discover)
751
769
"duration" => {
@@ -807,6 +825,7 @@ mod tests {
807
825
use chrono:: { TimeZone , Utc } ;
808
826
use relay_protocol:: { ErrorKind , Map , Meta } ;
809
827
use similar_asserts:: assert_eq;
828
+ use std:: collections:: BTreeMap ;
810
829
use uuid:: uuid;
811
830
812
831
use super :: * ;
@@ -1158,6 +1177,16 @@ mod tests {
1158
1177
) ) ) ,
1159
1178
..ProfileContext :: default ( )
1160
1179
} ) ;
1180
+ let mut monitor_context_fields = BTreeMap :: new ( ) ;
1181
+ monitor_context_fields. insert (
1182
+ "id" . to_string ( ) ,
1183
+ Annotated :: new ( Value :: String ( "123" . to_string ( ) ) ) ,
1184
+ ) ;
1185
+ monitor_context_fields. insert (
1186
+ "slug" . to_string ( ) ,
1187
+ Annotated :: new ( Value :: String ( "my_monitor" . to_string ( ) ) ) ,
1188
+ ) ;
1189
+ contexts. add ( MonitorContext ( monitor_context_fields) ) ;
1161
1190
contexts
1162
1191
} ) ,
1163
1192
..Default :: default ( )
@@ -1272,6 +1301,14 @@ mod tests {
1272
1301
Some ( Val :: String ( "message" ) ) ,
1273
1302
event. get_value( "event.logentry.message" )
1274
1303
) ;
1304
+ assert_eq ! (
1305
+ Some ( Val :: String ( "123" ) ) ,
1306
+ event. get_value( "event.contexts.monitor.id" )
1307
+ ) ;
1308
+ assert_eq ! (
1309
+ Some ( Val :: String ( "my_monitor" ) ) ,
1310
+ event. get_value( "event.contexts.monitor.slug" )
1311
+ ) ;
1275
1312
}
1276
1313
1277
1314
#[ test]
0 commit comments