📝 BLOG.IK.AM

@making's memo
(🗃 Categories 🏷 Tags)

Spring Boot ActuatorのThreaddumpエンドでライブスレッド名を取得する

🗃 {Programming/Java/org/springframework/boot}

🏷 Spring Boot 🏷 Spring Boot Actuator

🗓 Updated at 2018-01-02T21:58:18+09:00 by Toshiaki Maki  🗓 Created at 2017-11-13T03:24:42+09:00 by Toshiaki Maki  {✒️️ Edit  ⏰ History}


メモ

Spring Boot 1の場合

curl -s http://localhost:8080/dump | jq '.[].threadName'

RUNNABLEな状態のみの場合

curl -s http://localhost:8080/dump | jq '. | map(select(.threadState == "RUNNABLE"))[].threadName'

watchしたいなら

watch -n 1 "curl -s http://localhost:8080/dump  | jq '. | map(select(.threadState == \"RUNNABLE\"))[].threadName'"

Spring Boot 2 (2.0.0.M7以降)の場合

2.0.0.M7からActuatorエンドポイントのprefixが変わりました。 [URL]

curl -s http://localhost:8080/actuator/threaddump  | jq '.threads[].threadName'

RUNNABLEな状態のみの場合

curl -s http://localhost:8080/actuator/threaddump  | jq '.threads | map(select(.threadState == "RUNNABLE"))[].threadName'

watchしたいなら

watch -n 1 "curl -s http://localhost:8080/actuator/threaddump  | jq '.threads | map(select(.threadState == \"RUNNABLE\"))[].threadName'"

Spring Boot 2 (2.0.0.M6以前)の場合

curl -s http://localhost:8080/application/threaddump  | jq '.threads[].threadName'

RUNNABLEな状態のみの場合

curl -s http://localhost:8080/application/threaddump  | jq '.threads | map(select(.threadState == "RUNNABLE"))[].threadName'

watchしたいなら

watch -n 1 "curl -s http://localhost:8080/application/threaddump  | jq '.threads | map(select(.threadState == \"RUNNABLE\"))[].threadName'"