From e6c43fbe5c1627796696b285eefc2cd93b3eb1c9 Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Thu, 15 Feb 2024 17:58:00 +0100 Subject: [PATCH 1/3] feat(proguard): Add types for JVM requests --- crates/symbolicator-proguard/src/interface.rs | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/crates/symbolicator-proguard/src/interface.rs b/crates/symbolicator-proguard/src/interface.rs index 8b1378917..286501196 100644 --- a/crates/symbolicator-proguard/src/interface.rs +++ b/crates/symbolicator-proguard/src/interface.rs @@ -1 +1,62 @@ +use std::sync::Arc; +use serde::{Deserialize, Serialize}; +use symbolic::common::DebugId; +use symbolicator_service::types::{RawObjectInfo, Scope}; +use symbolicator_sources::SourceConfig; + +#[derive(Debug, Clone)] +pub struct SymbolicateJvmStacktraces { + pub scope: Scope, + pub sources: Arc<[SourceConfig]>, + pub exceptions: Vec, + pub modules: Vec, + /// Whether to apply source context for the stack frames. + pub apply_source_context: bool, +} + +#[derive(Debug, Default, Clone, Deserialize, Serialize, PartialEq, Eq)] +pub struct JvmFrame { + #[serde(skip_serializing_if = "Option::is_none")] + pub function: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub filename: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + pub module: Option, + + pub abs_path: String, + + pub lineno: u32, + + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub pre_context: Vec, + + #[serde(skip_serializing_if = "Option::is_none")] + pub context_line: Option, + + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub post_context: Vec, + + #[serde(skip_serializing_if = "Option::is_none")] + pub in_app: Option, +} + +#[derive(Debug, Default, Clone, Deserialize, Serialize, PartialEq, Eq)] +pub struct JvmException { + #[serde(rename = "type")] + ty: String, + module: String, + stacktrace: JvmStacktrace, +} + +#[derive(Debug, Default, Clone, Deserialize, Serialize, PartialEq, Eq)] +pub struct JvmStacktrace { + frames: Vec, +} + +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] +pub struct JvmModule { + uuid: DebugId, +} From 22ab5b524ad8e2392563b7a2ad989022beb19c71 Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Thu, 15 Feb 2024 18:09:28 +0100 Subject: [PATCH 2/3] Fix import --- crates/symbolicator-proguard/src/interface.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/symbolicator-proguard/src/interface.rs b/crates/symbolicator-proguard/src/interface.rs index 286501196..207a86965 100644 --- a/crates/symbolicator-proguard/src/interface.rs +++ b/crates/symbolicator-proguard/src/interface.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use serde::{Deserialize, Serialize}; use symbolic::common::DebugId; -use symbolicator_service::types::{RawObjectInfo, Scope}; +use symbolicator_service::types::Scope; use symbolicator_sources::SourceConfig; #[derive(Debug, Clone)] From aebc9587271ab3a5682a3de22dffa18bf3281023 Mon Sep 17 00:00:00 2001 From: Sebastian Zivota Date: Fri, 16 Feb 2024 11:52:20 +0100 Subject: [PATCH 3/3] Add docs --- crates/symbolicator-proguard/src/interface.rs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/crates/symbolicator-proguard/src/interface.rs b/crates/symbolicator-proguard/src/interface.rs index 207a86965..490540e06 100644 --- a/crates/symbolicator-proguard/src/interface.rs +++ b/crates/symbolicator-proguard/src/interface.rs @@ -5,58 +5,83 @@ use symbolic::common::DebugId; use symbolicator_service::types::Scope; use symbolicator_sources::SourceConfig; +/// A request for symbolication/remapping of a JVM event. #[derive(Debug, Clone)] pub struct SymbolicateJvmStacktraces { + /// The scope of this request which determines access to cached files. pub scope: Scope, + /// A list of external sources to load debug files. pub sources: Arc<[SourceConfig]>, + /// The exceptions to symbolicate/remap. pub exceptions: Vec, + /// A list of proguard files to use for remapping. pub modules: Vec, /// Whether to apply source context for the stack frames. pub apply_source_context: bool, } +/// A stack frame in a JVM stacktrace. #[derive(Debug, Default, Clone, Deserialize, Serialize, PartialEq, Eq)] pub struct JvmFrame { + /// The frame's function name. #[serde(skip_serializing_if = "Option::is_none")] pub function: Option, + /// The source file name. #[serde(skip_serializing_if = "Option::is_none")] pub filename: Option, + /// The module name. #[serde(skip_serializing_if = "Option::is_none")] pub module: Option, + /// The source file's absolute path. pub abs_path: String, + /// The line number within the source file, starting at `1` for the first line. pub lineno: u32, + /// Source context before the context line. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub pre_context: Vec, + /// The context line if available. #[serde(skip_serializing_if = "Option::is_none")] pub context_line: Option, + /// Post context after the context line #[serde(default, skip_serializing_if = "Vec::is_empty")] pub post_context: Vec, + /// Whether the frame is related to app-code (rather than libraries/dependencies). #[serde(skip_serializing_if = "Option::is_none")] pub in_app: Option, } +/// An exception in a JVM event. #[derive(Debug, Default, Clone, Deserialize, Serialize, PartialEq, Eq)] pub struct JvmException { + /// The type (class name) of the exception. #[serde(rename = "type")] ty: String, + /// The module in which the exception is defined. module: String, + /// The stacktrace associated with the exception. stacktrace: JvmStacktrace, } +/// A JVM stacktrace. #[derive(Debug, Default, Clone, Deserialize, Serialize, PartialEq, Eq)] pub struct JvmStacktrace { + /// The stacktrace's frames. frames: Vec, } +/// A JVM module (proguard file). #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] pub struct JvmModule { + /// The file's UUID. + /// + /// This is used to download the file from symbol sources. uuid: DebugId, }