Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic pyroscope agent #2367

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions polkadot/node/subsystem-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ prometheus_endpoint = { package = "substrate-prometheus-endpoint", path = "../..
prometheus = { version = "0.13.0", default-features = false }
toml = "0.8.8"
serde = "1.0.192"
pyroscope = "0.5.7"
pyroscope_pprofrs = "0.2.7"

[features]
default = []
12 changes: 12 additions & 0 deletions polkadot/node/subsystem-bench/src/subsystem-bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ fn new_runtime() -> tokio::runtime::Runtime {
impl BenchCli {
fn launch(self) -> eyre::Result<()> {
use prometheus::Registry;
use pyroscope::PyroscopeAgent;
use pyroscope_pprofrs::{pprof_backend, PprofConfig};

// Pyroscope must be running on port 4040
// See https://grafana.com/docs/pyroscope/latest/get-started/#download-and-configure-pyroscope
let agent = PyroscopeAgent::builder("http://localhost:4040", "subsystem-bench")
.backend(pprof_backend(PprofConfig::new().sample_rate(100)))
.build()?;
let agent_running = agent.start()?;

let runtime = new_runtime();

Expand Down Expand Up @@ -253,6 +262,9 @@ impl BenchCli {

runtime.block_on(availability::bench_chunk_recovery(&mut env));

let agent_ready = agent_running.stop()?;
agent_ready.shutdown();

Ok(())
}
}
Expand Down
Loading