Crates.io | pyroscope |
lib.rs | pyroscope |
version | 0.5.7 |
source | src |
created_at | 2021-12-17 17:55:57.73933 |
updated_at | 2023-08-04 03:04:47.432799 |
description | Pyroscope Profiler Agent for continuous profiling of Rust, Python and Ruby applications. |
homepage | https://pyroscope.io/docs/rust |
repository | https://github.com/pyroscope-io/pyroscope-rs |
max_upload_size | |
id | 499702 |
size | 333,040 |
Pyroscope Profiler for Rust. Profile your Rust applications.
You may be looking for:
Add this to your Cargo.toml
:
[dependencies]
pyroscope = "0.5.4"
pyroscope_pprofrs = "0.2"
Include Pyroscope and pprof-rs dependencies:
use pyroscope::PyroscopeAgent;
use pyroscope_pprofrs::{pprof_backend, PprofConfig};
Configure the Pyroscope agent:
let agent =
PyroscopeAgent::builder("http://localhost:4040", "myapp-profile")
.backend(pprof_backend(PprofConfig::new().sample_rate(100)))
.build()?;
Profile your code:
let agent_running = agent.start()?;
// Computation to profile
let agent_ready = agent_running.stop()?;
agent_ready.shutdown();
The Pyroscope Agent send the profiling data to a Pyroscope Server. You need to have a Pyroscope Server running in order to consume and visualize this data. It's not possible, currently, to forward the data to another endpoint.
The Pyroscope Agent and the pprof-rs backend can profile and report data from a multi-threaded program. pprof-rs, however, does not track child-processes and thus profiling is limited to a single process.
The Pyroscope Agent doesn't do any profiling. The agent role is to orchestrate a profiling backend, and report the profiling data to the Pyroscope Server. The Agent can support external backends (in fact, all current backends are independent crates) and you can make your own. Backends can also be used seperately. The currently available backends are:
Pyroscope can be used directly from your projects with native integration. No agent or external programs are required.
Python: Python Package. Readme - Documentation
Ruby: Ruby Gem. Readme - Documentation
shutdown
function before dropping the Agent.You can read the Docs or check the examples for detailed usage of the library. You can also join the Slack channel if you have questions.
We'd like to give a big thank you to the following contributors who have made significant contributions to this project:
Pyroscope is distributed under the Apache License (Version 2.0).
See LICENSE for details.