risingwave_meta_service/
monitor_service.rs

1// Copyright 2025 RisingWave Labs
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use risingwave_meta::manager::MetadataManager;
16use risingwave_meta::rpc::await_tree::dump_cluster_await_tree;
17use risingwave_pb::monitor_service::monitor_service_server::MonitorService;
18use risingwave_pb::monitor_service::{self, StackTraceRequest, StackTraceResponse};
19use tonic::{Request, Response, Status};
20
21/// The [`MonitorService`] implementation for meta node.
22///
23/// Currently, only [`MonitorService::stack_trace`] is implemented, which returns the await tree of
24/// all nodes in the cluster.
25pub struct MonitorServiceImpl {
26    pub metadata_manager: MetadataManager,
27    pub await_tree_reg: await_tree::Registry,
28}
29
30#[tonic::async_trait]
31impl MonitorService for MonitorServiceImpl {
32    async fn stack_trace(
33        &self,
34        request: Request<StackTraceRequest>,
35    ) -> Result<Response<StackTraceResponse>, Status> {
36        let request = request.into_inner();
37        let actor_traces_format = request.actor_traces_format();
38
39        let result = dump_cluster_await_tree(
40            &self.metadata_manager,
41            &self.await_tree_reg,
42            actor_traces_format,
43        )
44        .await?;
45
46        Ok(Response::new(result))
47    }
48
49    async fn profiling(
50        &self,
51        _request: Request<monitor_service::ProfilingRequest>,
52    ) -> Result<Response<monitor_service::ProfilingResponse>, Status> {
53        Err(Status::unimplemented("not implemented in meta node"))
54    }
55
56    async fn heap_profiling(
57        &self,
58        _request: Request<monitor_service::HeapProfilingRequest>,
59    ) -> Result<Response<monitor_service::HeapProfilingResponse>, Status> {
60        Err(Status::unimplemented("not implemented in meta node"))
61    }
62
63    async fn list_heap_profiling(
64        &self,
65        _request: Request<monitor_service::ListHeapProfilingRequest>,
66    ) -> Result<Response<monitor_service::ListHeapProfilingResponse>, Status> {
67        Err(Status::unimplemented("not implemented in meta node"))
68    }
69
70    async fn analyze_heap(
71        &self,
72        _request: Request<monitor_service::AnalyzeHeapRequest>,
73    ) -> Result<Response<monitor_service::AnalyzeHeapResponse>, Status> {
74        Err(Status::unimplemented("not implemented in meta node"))
75    }
76
77    async fn get_streaming_stats(
78        &self,
79        _request: Request<monitor_service::GetStreamingStatsRequest>,
80    ) -> Result<Response<monitor_service::GetStreamingStatsResponse>, Status> {
81        Err(Status::unimplemented("not implemented in meta node"))
82    }
83
84    async fn tiered_cache_tracing(
85        &self,
86        _request: Request<monitor_service::TieredCacheTracingRequest>,
87    ) -> Result<Response<monitor_service::TieredCacheTracingResponse>, Status> {
88        Err(Status::unimplemented("not implemented in meta node"))
89    }
90
91    async fn get_profile_stats(
92        &self,
93        _request: Request<monitor_service::GetProfileStatsRequest>,
94    ) -> Result<Response<monitor_service::GetProfileStatsResponse>, Status> {
95        Err(Status::unimplemented("not implemented in meta node"))
96    }
97}