Skip to main content

risingwave_storage/monitor/
mod.rs

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