Skip to content

Commit

Permalink
Dump hot threads
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Dec 5, 2024
1 parent 7d4225e commit bb04376
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import org.apache.logging.log4j.Logger;

import org.opensearch.action.admin.cluster.health.ClusterHealthResponse;
import org.opensearch.action.admin.cluster.node.hotthreads.NodesHotThreadsResponse;
import org.opensearch.action.admin.cluster.node.stats.NodeStats;
import org.opensearch.action.admin.cluster.node.stats.NodesStatsRequest;
import org.opensearch.action.admin.cluster.node.stats.NodesStatsResponse;
Expand Down Expand Up @@ -254,6 +255,13 @@ public void stop(boolean checkActiveThreads) throws IOException {
}
}
if (threadsActive) {
// TODO Hot Threads added for debugging
NodesHotThreadsResponse hotThreadsResponse = adminClient.cluster().prepareNodesHotThreads().get();
if (hotThreadsResponse.getNodes().isEmpty()) {
log.warn("Hot threads response is empty");
break;
}
log.warn("Hot threads stack trace: {}", hotThreadsResponse.getNodes().get(0).getHotThreads());
break;
}
}
Expand Down

0 comments on commit bb04376

Please sign in to comment.