IK.AM

@making's tech note


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

🗃 {Programming/Java/org/springframework/boot}
🏷 Spring Boot 🏷 Spring Boot Actuator 
🗓 Updated at 2018-01-02T12:58:18Z  🗓 Created at 2017-11-12T18:24:42Z   🌎 English Page

メモ

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'"

✒️️ Edit  ⏰ History  🗑 Delete