@@ -252,7 +252,7 @@ impl Default for Breadcrumb {
252
252
category : None ,
253
253
level : Level :: Info ,
254
254
message : None ,
255
- data : HashMap :: new ( ) ,
255
+ data : HashMap :: with_capacity ( 0 ) ,
256
256
}
257
257
}
258
258
}
@@ -283,10 +283,12 @@ pub struct Request {
283
283
#[ serde( flatten) ] pub other : HashMap < String , Value > ,
284
284
}
285
285
286
- /// Represents debug meta information.
287
- #[ derive( Serialize , Deserialize , Debug , Default , Clone , PartialEq ) ]
288
- #[ serde( default ) ]
289
- pub struct SdkInfo {
286
+ /// Holds information about the system SDK.
287
+ ///
288
+ /// This is relevant for iOS and other platforms that have a system
289
+ /// SDK. Not to be confused with the client SDK.
290
+ #[ derive( Serialize , Deserialize , Debug , Clone , PartialEq ) ]
291
+ pub struct SystemSdkInfo {
290
292
/// The internal name of the SDK
291
293
sdk_name : String ,
292
294
/// the major version of the SDK as integer or 0
@@ -343,15 +345,14 @@ pub struct ProguardDebugImage {
343
345
pub struct DebugMeta {
344
346
/// Optional system SDK information.
345
347
#[ serde( skip_serializing_if = "Option::is_none" ) ]
346
- sdk_info : Option < SdkInfo > ,
348
+ sdk_info : Option < SystemSdkInfo > ,
347
349
/// A list of debug information files.
348
350
#[ serde( skip_serializing_if = "Option::is_none" ) ]
349
351
images : Option < DebugImage > ,
350
352
}
351
353
352
354
/// Represents a repository reference.
353
- #[ derive( Serialize , Deserialize , Debug , Default , Clone , PartialEq ) ]
354
- #[ serde( default ) ]
355
+ #[ derive( Serialize , Deserialize , Debug , Clone , PartialEq ) ]
355
356
pub struct RepoReference {
356
357
/// The name of the repository as it is registered in Sentry.
357
358
pub name : String ,
@@ -362,6 +363,18 @@ pub struct RepoReference {
362
363
pub revision : Option < String > ,
363
364
}
364
365
366
+ /// Represents a repository reference.
367
+ #[ derive( Serialize , Deserialize , Debug , Clone , PartialEq ) ]
368
+ pub struct ClientSdkInfo {
369
+ /// The name of the SDK.
370
+ pub name : String ,
371
+ /// The version of the SDK.
372
+ pub version : String ,
373
+ /// An optional list of integrations that are enabled in this SDK.
374
+ #[ serde( skip_serializing_if = "Vec::is_empty" ) ]
375
+ pub integrations : Vec < String >
376
+ }
377
+
365
378
/// Represents a full event for Sentry.
366
379
#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq ) ]
367
380
#[ serde( default ) ]
@@ -372,13 +385,22 @@ pub struct Event {
372
385
/// An optional fingerprint configuration to override the default.
373
386
#[ serde( skip_serializing_if = "is_default_fingerprint" ) ]
374
387
pub fingerprint : Vec < String > ,
388
+ /// The culprit or transaction name of the event.
389
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
390
+ pub culprit : Option < String > ,
375
391
/// A message to be sent with the event.
376
392
#[ serde( skip_serializing_if = "Option::is_none" ) ]
377
393
pub message : Option < String > ,
378
394
/// Optionally a log entry that can be used instead of the message for
379
395
/// more complex cases.
380
396
#[ serde( skip_serializing_if = "Option::is_none" ) ]
381
397
pub logentry : Option < LogEntry > ,
398
+ /// Optionally the name of the logger that created this event.
399
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
400
+ pub logger : Option < String > ,
401
+ /// Optionally a name to version mapping of installed modules.
402
+ #[ serde( skip_serializing_if = "HashMap::is_empty" ) ]
403
+ pub modules : HashMap < String , String > ,
382
404
/// A platform identifier for this event.
383
405
#[ serde( skip_serializing_if = "is_other" ) ]
384
406
pub platform : String ,
@@ -437,10 +459,12 @@ pub struct Event {
437
459
/// Debug meta information.
438
460
#[ serde( skip_serializing_if = "Option::is_none" ) ]
439
461
pub debug_meta : Option < DebugMeta > ,
462
+ /// SDK metadata
463
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
464
+ pub sdk_info : Option < ClientSdkInfo > ,
440
465
/// Additional arbitrary keys for forwards compatibility.
441
466
#[ serde( flatten) ]
442
467
pub other : HashMap < String , Value > ,
443
- // TODO: repos, sdk, logger, culprit, modules
444
468
}
445
469
446
470
fn is_other ( value : & str ) -> bool {
@@ -456,27 +480,31 @@ impl Default for Event {
456
480
Event {
457
481
level : Level :: Error ,
458
482
fingerprint : vec ! [ "{{ default }}" . into( ) ] ,
483
+ culprit : None ,
459
484
message : None ,
460
485
logentry : None ,
486
+ logger : None ,
487
+ modules : HashMap :: with_capacity ( 0 ) ,
461
488
platform : "other" . into ( ) ,
462
489
timestamp : None ,
463
490
server_name : None ,
464
491
release : None ,
465
- repos : HashMap :: new ( ) ,
492
+ repos : HashMap :: with_capacity ( 0 ) ,
466
493
dist : None ,
467
494
environment : None ,
468
495
user : None ,
469
496
request : None ,
470
- contexts : HashMap :: new ( ) ,
497
+ contexts : HashMap :: with_capacity ( 0 ) ,
471
498
breadcrumbs : Vec :: new ( ) ,
472
499
exceptions : Vec :: new ( ) ,
473
500
stacktrace : None ,
474
501
template_info : None ,
475
502
threads : Vec :: new ( ) ,
476
- tags : HashMap :: new ( ) ,
477
- extra : HashMap :: new ( ) ,
503
+ tags : HashMap :: with_capacity ( 0 ) ,
504
+ extra : HashMap :: with_capacity ( 0 ) ,
478
505
debug_meta : None ,
479
- other : HashMap :: new ( ) ,
506
+ sdk_info : None ,
507
+ other : HashMap :: with_capacity ( 0 ) ,
480
508
}
481
509
}
482
510
}
@@ -561,7 +589,7 @@ impl From<ContextType> for Context {
561
589
fn from ( data : ContextType ) -> Context {
562
590
Context {
563
591
data : data,
564
- extra : HashMap :: new ( ) ,
592
+ extra : HashMap :: with_capacity ( 0 ) ,
565
593
}
566
594
}
567
595
}
0 commit comments