Skip to content

Commit

Permalink
fix: migrate to pprof2 crate (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
mati865 authored Nov 18, 2024
1 parent face91b commit ab864c6
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 60 deletions.
115 changes: 66 additions & 49 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pyroscope_backends/pyroscope_pprofrs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ readme = "README.md"


[dependencies]
pprof = "0.12"
pyroscope = { version = "0.5.7", path = "../../", default-features = false }
pprof2 = "0.13"
pyroscope = { version = "0.5.7", path = "../..", default-features = false }
thiserror ="1.0"
log = "0.4"

[features]
default = ["pyroscope/default"]
frame-pointer = ["pprof/frame-pointer"]
frame-pointer = ["pprof2/frame-pointer"]

[target.aarch64-apple-darwin.dependencies]
pprof = { version = "0.12", features = ["frame-pointer"] }
pprof2 = { version = "0.13", features = ["frame-pointer"] }


14 changes: 7 additions & 7 deletions pyroscope_backends/pyroscope_pprofrs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use pprof::{ProfilerGuard, ProfilerGuardBuilder};
use pprof2::{ProfilerGuard, ProfilerGuardBuilder};
use pyroscope::{
backend::{
Backend, BackendConfig, BackendImpl, BackendUninitialized, Report, Rule, Ruleset,
Expand Down Expand Up @@ -259,8 +259,8 @@ impl From<StackBufferWrapper> for StackBuffer {
}
}

impl From<(pprof::Report, &BackendConfig)> for StackBufferWrapper {
fn from(arg: (pprof::Report, &BackendConfig)) -> Self {
impl From<(pprof2::Report, &BackendConfig)> for StackBufferWrapper {
fn from(arg: (pprof2::Report, &BackendConfig)) -> Self {
let (report, config) = arg;
//convert report to stackbuffer
let buffer_data: HashMap<StackTrace, usize> = report
Expand All @@ -285,8 +285,8 @@ impl From<StackTraceWrapper> for StackTrace {
}
}

impl From<(pprof::Frames, &BackendConfig)> for StackTraceWrapper {
fn from(arg: (pprof::Frames, &BackendConfig)) -> Self {
impl From<(pprof2::Frames, &BackendConfig)> for StackTraceWrapper {
fn from(arg: (pprof2::Frames, &BackendConfig)) -> Self {
let (frames, config) = arg;
StackTraceWrapper(StackTrace::new(
config,
Expand All @@ -311,8 +311,8 @@ impl From<StackFrameWrapper> for StackFrame {
}
}

impl From<pprof::Symbol> for StackFrameWrapper {
fn from(symbol: pprof::Symbol) -> Self {
impl From<pprof2::Symbol> for StackFrameWrapper {
fn from(symbol: pprof2::Symbol) -> Self {
StackFrameWrapper(StackFrame::new(
None,
Some(symbol.name()),
Expand Down

0 comments on commit ab864c6

Please sign in to comment.