Skip to content
Merged
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async fn main() {
}

let app = axum::Router::new()
.route("/debug/pprof/heap", axum::routing::get(handle_get_heap));
.route("/debug/pprof/allocs", axum::routing::get(handle_get_heap));

// run our app with hyper, listening globally on port 3000
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
Expand Down Expand Up @@ -89,7 +89,7 @@ fn require_profiling_activated(prof_ctl: &jemalloc_pprof::JemallocProfCtl) -> Re
Then running the application, we can capture a profile and view it the pprof toolchain.

```shell
curl localhost:3000/debug/pprof/heap > heap.pb.gz
curl localhost:3000/debug/pprof/allocs > heap.pb.gz
pprof -http=:8080 heap.pb.gz
```

Expand Down Expand Up @@ -117,8 +117,8 @@ We can then adjust the example above to also emit a flamegraph SVG:
#[tokio::main]
async fn main() {
let app = axum::Router::new()
.route("/debug/pprof/heap", axum::routing::get(handle_get_heap))
.route("/debug/pprof/heap/flamegraph", axum::routing::get(handle_get_heap_flamegraph));
.route("/debug/pprof/allocs", axum::routing::get(handle_get_heap))
.route("/debug/pprof/allocs/flamegraph", axum::routing::get(handle_get_heap_flamegraph));
// ...
}

Expand Down
4 changes: 2 additions & 2 deletions example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ async fn main() {
v.push(i);
}

let app = axum::Router::new().route("/debug/pprof/heap", axum::routing::get(handle_get_heap));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude said it didn't want to update the function name handle_get_heap. Do we want to make that change? Let me know.

let app = axum::Router::new().route("/debug/pprof/allocs", axum::routing::get(handle_get_heap));

// Add a flamegraph SVG route if enabled via `cargo run -F flamegraph`.
#[cfg(feature = "flamegraph")]
let app = app.route(
"/debug/pprof/heap/flamegraph",
"/debug/pprof/allocs/flamegraph",
axum::routing::get(handle_get_heap_flamegraph),
);

Expand Down