risingwave_ctl/cmd_impl/
await_tree.rs1use risingwave_common::util::StackTraceResponseExt;
16use risingwave_common::util::addr::HostAddr;
17use risingwave_pb::common::WorkerType;
18use risingwave_pb::monitor_service::StackTraceResponse;
19use risingwave_rpc_client::{CompactorClient, ComputeClientPool};
20
21use crate::CtlContext;
22
23pub async fn dump(context: &CtlContext) -> anyhow::Result<()> {
24 let mut all = StackTraceResponse::default();
25
26 let meta_client = context.meta_client().await?;
27
28 let compute_nodes = meta_client
29 .list_worker_nodes(Some(WorkerType::ComputeNode))
30 .await?;
31 let clients = ComputeClientPool::adhoc();
32
33 for cn in compute_nodes {
36 let client = clients.get(&cn).await?;
37 let response = client.stack_trace().await?;
38 all.merge_other(response);
39 }
40
41 let compactor_nodes = meta_client
42 .list_worker_nodes(Some(WorkerType::Compactor))
43 .await?;
44
45 for compactor in compactor_nodes {
46 let addr: HostAddr = compactor.get_host().unwrap().into();
47 let client = CompactorClient::new(addr).await?;
48 let response = client.stack_trace().await?;
49 all.merge_other(response);
50 }
51
52 if all.actor_traces.is_empty()
53 && all.rpc_traces.is_empty()
54 && all.compaction_task_traces.is_empty()
55 && all.inflight_barrier_traces.is_empty()
56 {
57 println!("No traces found. No actors are running, or `--async-stack-trace` not set?");
58 }
59 println!("{}", all.output());
60
61 Ok(())
62}