risingwave_frontend/rpc/
monitor_service.rs

1// Copyright 2026 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_common::config::ServerConfig;
16use risingwave_common_heap_profiling::ProfileServiceImpl;
17use risingwave_pb::monitor_service::monitor_service_server::MonitorService;
18use risingwave_pb::monitor_service::{
19    AnalyzeHeapRequest, AnalyzeHeapResponse, GetProfileStatsRequest, GetProfileStatsResponse,
20    GetStreamingStatsRequest, GetStreamingStatsResponse, HeapProfilingRequest,
21    HeapProfilingResponse, ListHeapProfilingRequest, ListHeapProfilingResponse, ProfilingRequest,
22    ProfilingResponse, StackTraceRequest, StackTraceResponse, TieredCacheTracingRequest,
23    TieredCacheTracingResponse,
24};
25use tonic::{Request, Response, Status};
26
27/// Frontend implementation of monitor RPCs, currently reusing the profile service only.
28pub struct MonitorServiceImpl {
29    profile_service: ProfileServiceImpl,
30}
31
32impl MonitorServiceImpl {
33    pub fn new(server_config: ServerConfig) -> Self {
34        Self {
35            profile_service: ProfileServiceImpl::new(server_config),
36        }
37    }
38}
39
40#[async_trait::async_trait]
41impl MonitorService for MonitorServiceImpl {
42    async fn stack_trace(
43        &self,
44        _request: Request<StackTraceRequest>,
45    ) -> Result<Response<StackTraceResponse>, Status> {
46        Err(Status::unimplemented("not implemented in frontend node"))
47    }
48
49    async fn profiling(
50        &self,
51        request: Request<ProfilingRequest>,
52    ) -> Result<Response<ProfilingResponse>, Status> {
53        self.profile_service.profiling(request).await
54    }
55
56    async fn heap_profiling(
57        &self,
58        request: Request<HeapProfilingRequest>,
59    ) -> Result<Response<HeapProfilingResponse>, Status> {
60        self.profile_service.heap_profiling(request).await
61    }
62
63    async fn list_heap_profiling(
64        &self,
65        request: Request<ListHeapProfilingRequest>,
66    ) -> Result<Response<ListHeapProfilingResponse>, Status> {
67        self.profile_service.list_heap_profiling(request).await
68    }
69
70    async fn analyze_heap(
71        &self,
72        request: Request<AnalyzeHeapRequest>,
73    ) -> Result<Response<AnalyzeHeapResponse>, Status> {
74        self.profile_service.analyze_heap(request).await
75    }
76
77    async fn get_streaming_stats(
78        &self,
79        _request: Request<GetStreamingStatsRequest>,
80    ) -> Result<Response<GetStreamingStatsResponse>, Status> {
81        Err(Status::unimplemented("not implemented in frontend node"))
82    }
83
84    async fn tiered_cache_tracing(
85        &self,
86        _request: Request<TieredCacheTracingRequest>,
87    ) -> Result<Response<TieredCacheTracingResponse>, Status> {
88        Err(Status::unimplemented("not implemented in frontend node"))
89    }
90
91    async fn get_profile_stats(
92        &self,
93        _request: Request<GetProfileStatsRequest>,
94    ) -> Result<Response<GetProfileStatsResponse>, Status> {
95        Err(Status::unimplemented("not implemented in frontend node"))
96    }
97}