risingwave_storage/monitor/
mod.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
15mod hummock_state_store_metrics;
16use futures::Future;
17pub use hummock_state_store_metrics::*;
18mod monitored_store;
19pub use monitored_store::*;
20mod hummock_metrics;
21pub use hummock_metrics::*;
22
23mod monitored_storage_metrics;
24pub use monitored_storage_metrics::*;
25
26mod compactor_metrics;
27pub use compactor_metrics::*;
28
29mod local_metrics;
30pub use local_metrics::*;
31
32mod hitmap;
33pub use hitmap::*;
34pub use risingwave_object_store::object::object_metrics::{
35    GLOBAL_OBJECT_STORE_METRICS, ObjectStoreMetrics,
36};
37
38// include only when hummock trace enabled
39#[cfg(all(not(madsim), feature = "hm-trace"))]
40pub(crate) mod traced_store;
41
42pub trait HummockTraceFutureExt: Sized + Future {
43    type TraceOutput;
44    fn may_trace_hummock(self) -> Self::TraceOutput;
45}
46
47impl<F: Future> HummockTraceFutureExt for F {
48    type TraceOutput = impl Future<Output = F::Output>;
49
50    // simply return a future that does nothing if trace is not enabled
51    fn may_trace_hummock(self) -> Self::TraceOutput {
52        #[cfg(not(all(not(madsim), feature = "hm-trace")))]
53        {
54            self
55        }
56        #[cfg(all(not(madsim), feature = "hm-trace"))]
57        {
58            use risingwave_hummock_trace::hummock_trace_scope;
59            hummock_trace_scope(self)
60        }
61    }
62}