Skip to content

Commit 63e7ed8

Browse files
committed
feat: Added missing attributes
1 parent bdcbb8a commit 63e7ed8

File tree

1 file changed

+43
-15
lines changed

1 file changed

+43
-15
lines changed

src/protocol/v7.rs

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ impl Default for Breadcrumb {
252252
category: None,
253253
level: Level::Info,
254254
message: None,
255-
data: HashMap::new(),
255+
data: HashMap::with_capacity(0),
256256
}
257257
}
258258
}
@@ -283,10 +283,12 @@ pub struct Request {
283283
#[serde(flatten)] pub other: HashMap<String, Value>,
284284
}
285285

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 {
290292
/// The internal name of the SDK
291293
sdk_name: String,
292294
/// the major version of the SDK as integer or 0
@@ -343,15 +345,14 @@ pub struct ProguardDebugImage {
343345
pub struct DebugMeta {
344346
/// Optional system SDK information.
345347
#[serde(skip_serializing_if = "Option::is_none")]
346-
sdk_info: Option<SdkInfo>,
348+
sdk_info: Option<SystemSdkInfo>,
347349
/// A list of debug information files.
348350
#[serde(skip_serializing_if = "Option::is_none")]
349351
images: Option<DebugImage>,
350352
}
351353

352354
/// Represents a repository reference.
353-
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
354-
#[serde(default)]
355+
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
355356
pub struct RepoReference {
356357
/// The name of the repository as it is registered in Sentry.
357358
pub name: String,
@@ -362,6 +363,18 @@ pub struct RepoReference {
362363
pub revision: Option<String>,
363364
}
364365

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+
365378
/// Represents a full event for Sentry.
366379
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
367380
#[serde(default)]
@@ -372,13 +385,22 @@ pub struct Event {
372385
/// An optional fingerprint configuration to override the default.
373386
#[serde(skip_serializing_if = "is_default_fingerprint")]
374387
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>,
375391
/// A message to be sent with the event.
376392
#[serde(skip_serializing_if = "Option::is_none")]
377393
pub message: Option<String>,
378394
/// Optionally a log entry that can be used instead of the message for
379395
/// more complex cases.
380396
#[serde(skip_serializing_if = "Option::is_none")]
381397
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>,
382404
/// A platform identifier for this event.
383405
#[serde(skip_serializing_if = "is_other")]
384406
pub platform: String,
@@ -437,10 +459,12 @@ pub struct Event {
437459
/// Debug meta information.
438460
#[serde(skip_serializing_if = "Option::is_none")]
439461
pub debug_meta: Option<DebugMeta>,
462+
/// SDK metadata
463+
#[serde(skip_serializing_if = "Option::is_none")]
464+
pub sdk_info: Option<ClientSdkInfo>,
440465
/// Additional arbitrary keys for forwards compatibility.
441466
#[serde(flatten)]
442467
pub other: HashMap<String, Value>,
443-
// TODO: repos, sdk, logger, culprit, modules
444468
}
445469

446470
fn is_other(value: &str) -> bool {
@@ -456,27 +480,31 @@ impl Default for Event {
456480
Event {
457481
level: Level::Error,
458482
fingerprint: vec!["{{ default }}".into()],
483+
culprit: None,
459484
message: None,
460485
logentry: None,
486+
logger: None,
487+
modules: HashMap::with_capacity(0),
461488
platform: "other".into(),
462489
timestamp: None,
463490
server_name: None,
464491
release: None,
465-
repos: HashMap::new(),
492+
repos: HashMap::with_capacity(0),
466493
dist: None,
467494
environment: None,
468495
user: None,
469496
request: None,
470-
contexts: HashMap::new(),
497+
contexts: HashMap::with_capacity(0),
471498
breadcrumbs: Vec::new(),
472499
exceptions: Vec::new(),
473500
stacktrace: None,
474501
template_info: None,
475502
threads: Vec::new(),
476-
tags: HashMap::new(),
477-
extra: HashMap::new(),
503+
tags: HashMap::with_capacity(0),
504+
extra: HashMap::with_capacity(0),
478505
debug_meta: None,
479-
other: HashMap::new(),
506+
sdk_info: None,
507+
other: HashMap::with_capacity(0),
480508
}
481509
}
482510
}
@@ -561,7 +589,7 @@ impl From<ContextType> for Context {
561589
fn from(data: ContextType) -> Context {
562590
Context {
563591
data: data,
564-
extra: HashMap::new(),
592+
extra: HashMap::with_capacity(0),
565593
}
566594
}
567595
}

0 commit comments

Comments
 (0)