diff --git a/docs/how-to/how-to-profile-cpu.md b/docs/how-to/how-to-profile-cpu.md index b1c5ded09ee1..ff50b0ea44cd 100644 --- a/docs/how-to/how-to-profile-cpu.md +++ b/docs/how-to/how-to-profile-cpu.md @@ -3,7 +3,7 @@ ## HTTP API Sample at 99 Hertz, for 5 seconds, output report in [protobuf format](https://github.com/google/pprof/blob/master/proto/profile.proto). ```bash -curl -s '0:4000/debug/prof/cpu' > /tmp/pprof.out +curl -X POST -s '0:4000/debug/prof/cpu' > /tmp/pprof.out ``` Then you can use `pprof` command with the protobuf file. @@ -13,10 +13,10 @@ go tool pprof -top /tmp/pprof.out Sample at 99 Hertz, for 60 seconds, output report in flamegraph format. ```bash -curl -s '0:4000/debug/prof/cpu?seconds=60&output=flamegraph' > /tmp/pprof.svg +curl -X POST -s '0:4000/debug/prof/cpu?seconds=60&output=flamegraph' > /tmp/pprof.svg ``` Sample at 49 Hertz, for 10 seconds, output report in text format. ```bash -curl -s '0:4000/debug/prof/cpu?seconds=10&frequency=49&output=text' > /tmp/pprof.txt +curl -X POST -s '0:4000/debug/prof/cpu?seconds=10&frequency=49&output=text' > /tmp/pprof.txt ``` diff --git a/docs/how-to/how-to-profile-memory.md b/docs/how-to/how-to-profile-memory.md index a0fe42df55ce..257e834e0b00 100644 --- a/docs/how-to/how-to-profile-memory.md +++ b/docs/how-to/how-to-profile-memory.md @@ -29,7 +29,7 @@ MALLOC_CONF=prof:true,lg_prof_interval:28 ./target/debug/greptime standalone sta Dump memory profiling data through HTTP API: ```bash -curl localhost:4000/debug/prof/mem > greptime.hprof +curl -X POST localhost:4000/debug/prof/mem > greptime.hprof ``` You can periodically dump profiling data and compare them to find the delta memory usage. diff --git a/src/servers/src/http.rs b/src/servers/src/http.rs index 5b64fbd283e1..c719e02cac35 100644 --- a/src/servers/src/http.rs +++ b/src/servers/src/http.rs @@ -705,22 +705,12 @@ impl HttpServer { "/debug", Router::new() // handler for changing log level dynamically - .route( - "/log_level", - routing::get(dyn_log::dyn_log_handler).post(dyn_log::dyn_log_handler), - ) + .route("/log_level", routing::post(dyn_log::dyn_log_handler)) .nest( "/prof", Router::new() - .route( - "/cpu", - routing::get(pprof::pprof_handler).post(pprof::pprof_handler), - ) - .route( - "/mem", - routing::get(mem_prof::mem_prof_handler) - .post(mem_prof::mem_prof_handler), - ), + .route("/cpu", routing::post(pprof::pprof_handler)) + .route("/mem", routing::post(mem_prof::mem_prof_handler)), ), ) }