From fda57ec61e309304a9ebd55d7298311817afc77f Mon Sep 17 00:00:00 2001 From: Abid Omar Date: Fri, 29 Apr 2022 00:30:57 +0100 Subject: [PATCH 1/2] imp(agent): shutdown backend on shutdown --- src/pyroscope.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pyroscope.rs b/src/pyroscope.rs index c201016f..b6e22263 100644 --- a/src/pyroscope.rs +++ b/src/pyroscope.rs @@ -266,6 +266,12 @@ impl PyroscopeAgent { pub fn shutdown(mut self) { log::debug!(target: LOG_TAG, "PyroscopeAgent::drop()"); + // Shutdown Backend + match self.backend.shutdown() { + Ok(_) => log::debug!(target: LOG_TAG, "Backend shutdown"), + Err(e) => log::error!(target: LOG_TAG, "Backend shutdown error: {}", e), + } + // Drop Timer listeners match self.timer.drop_listeners() { Ok(_) => log::trace!(target: LOG_TAG, "Dropped timer listeners"), From 0a74c23e07de693ea2fda7fe00461654f15d91f7 Mon Sep 17 00:00:00 2001 From: Abid Omar Date: Sun, 1 May 2022 12:11:32 +0100 Subject: [PATCH 2/2] chore: update docs --- Cargo.toml | 2 +- README.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 14d688fd..9827918b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ Pyroscope Profiler Agent for continuous profiling of Rust, Python and Ruby appli """ keywords = ["pyroscope", "profiler", "profiling", "pprof"] authors = ["Abid Omar "] -version = "0.5.0" +version = "0.5.1" edition = "2021" license = "Apache-2.0" homepage = "https://pyroscope.io/docs/rust" diff --git a/README.md b/README.md index 4b6a2778..7ab1b53c 100644 --- a/README.md +++ b/README.md @@ -36,11 +36,11 @@ pyroscope = "0.5.0" pyroscope-pprofrs = "0.2" ``` -Configure and create the backend (pprof-rs) +Include Pyroscope and pprof-rs dependencies: ```rust -let pprof_config = PprofConfig::new().sample_rate(100); -let pprof_backend = Pprof::new(pprof_config); +use pyroscope::PyroscopeAgent; +use pyroscope_pprofrs::{pprof_backend, PprofConfig}; ``` Configure the Pyroscope agent: @@ -48,7 +48,7 @@ Configure the Pyroscope agent: ```rust let agent = PyroscopeAgent::builder("http://localhost:4040", "myapp-profile") - .backend(pprof_backend) + .backend(pprof_backend(PprofConfig::new().sample_rate(100))) .build()?; ```