-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Tag "number of frames" metrics with platforms (#1562)
Each count is tagged with the platform of the individual frames as well as that of the whole event. As a drive-by, this also implements `AsRef<str>` for the platform types.
- Loading branch information
1 parent
8faeb5c
commit de05225
Showing
7 changed files
with
152 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,44 @@ | ||
use std::{collections::HashMap, sync::Arc}; | ||
|
||
use symbolicator_service::metric; | ||
use symbolicator_service::{metric, types::Platform}; | ||
|
||
use crate::interface::{JvmException, JvmStacktrace}; | ||
|
||
/// Record metrics about exceptions, stacktraces, frames, and remapped classes. | ||
pub fn record_symbolication_metrics( | ||
event_platform: Option<Platform>, | ||
exceptions: &[JvmException], | ||
stacktraces: &[JvmStacktrace], | ||
classes: &HashMap<Arc<str>, Arc<str>>, | ||
unsymbolicated_frames: u64, | ||
) { | ||
let event_platform = event_platform | ||
.as_ref() | ||
.map(|p| p.as_ref()) | ||
.unwrap_or("none"); | ||
|
||
metric!(time_raw("symbolication.num_exceptions") = exceptions.len() as u64); | ||
metric!(time_raw("symbolication.num_stacktraces") = stacktraces.len() as u64); | ||
metric!( | ||
time_raw("symbolication.num_frames") = stacktraces | ||
.iter() | ||
.map(|s| s.frames.len() as u64) | ||
.sum::<u64>() | ||
|
||
// Count number of frames by platform (including no platform) | ||
let frames_by_platform = stacktraces.iter().flat_map(|st| st.frames.iter()).fold( | ||
HashMap::new(), | ||
|mut map, frame| { | ||
let platform = frame.platform.as_ref(); | ||
let count: &mut usize = map.entry(platform).or_default(); | ||
*count += 1; | ||
map | ||
}, | ||
); | ||
|
||
for (p, count) in &frames_by_platform { | ||
let frame_platform = p.map(|p| p.as_ref()).unwrap_or("none"); | ||
metric!( | ||
time_raw("symbolication.num_frames") = | ||
count, | ||
"frame_platform" => frame_platform, "event_platform" => event_platform | ||
); | ||
} | ||
metric!(time_raw("symbolication.num_classes") = classes.len() as u64); | ||
metric!(time_raw("symbolication.unsymbolicated_frames") = unsymbolicated_frames); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.