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