Skip to content

Commit

Permalink
Merge pull request #26 from pyroscope-io/0.5.1
Browse files Browse the repository at this point in the history
0.5.1
  • Loading branch information
omarabid authored May 1, 2022
2 parents 039b270 + 0a74c23 commit b453009
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Pyroscope Profiler Agent for continuous profiling of Rust, Python and Ruby appli
"""
keywords = ["pyroscope", "profiler", "profiling", "pprof"]
authors = ["Abid Omar <[email protected]>"]
version = "0.5.0"
version = "0.5.1"
edition = "2021"
license = "Apache-2.0"
homepage = "https://pyroscope.io/docs/rust"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ 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:

```rust
let agent =
PyroscopeAgent::builder("http://localhost:4040", "myapp-profile")
.backend(pprof_backend)
.backend(pprof_backend(PprofConfig::new().sample_rate(100)))
.build()?;
```

Expand Down
6 changes: 6 additions & 0 deletions src/pyroscope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ impl<S: PyroscopeAgentState> PyroscopeAgent<S> {
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"),
Expand Down

0 comments on commit b453009

Please sign in to comment.