Skip to content

Commit

Permalink
Merge branch 'main' into wt-log-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jul 7, 2022
2 parents 93be928 + 79eb45b commit cad79b8
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 11 deletions.
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,10 @@ url = "2"
value-encoding = { path = "../utils/value-encoding" }
workspace-hack = { version = "0.1", path = "../workspace-hack" }

[target.'cfg(target_os = "linux")'.dependencies]
procinfo = { git = "https://github.com/tikv/procinfo-rs", rev = "6599eb9dca74229b2c1fcc44118bef7eff127128" }
procfs = { version = "0.12", default-features = false }
libc = "0.2"

[dev-dependencies]
rand = "0.8"
1 change: 1 addition & 0 deletions src/common/src/monitor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

pub mod my_stats;
pub mod process_linux;

use prometheus::core::{AtomicU64, Collector, GenericCounter, GenericCounterVec, Metric};
use prometheus::{Histogram, HistogramVec};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ pub struct ProcessCollector {
rss: IntGauge,
}

impl Default for ProcessCollector {
fn default() -> Self {
Self::new()
}
}

impl ProcessCollector {
pub fn new() -> Self {
let mut descs = Vec::new();
Expand Down
2 changes: 2 additions & 0 deletions src/compute/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use risingwave_batch::executor::monitor::BatchMetrics;
use risingwave_batch::rpc::service::task_service::BatchServiceImpl;
use risingwave_batch::task::{BatchEnvironment, BatchManager};
use risingwave_common::config::ComputeNodeConfig;
use risingwave_common::monitor::process_linux::monitor_process;
use risingwave_common::service::MetricsManager;
use risingwave_common::util::addr::HostAddr;
use risingwave_pb::common::WorkerType;
Expand Down Expand Up @@ -87,6 +88,7 @@ pub async fn compute_node_serve(
)];
// Initialize the metrics subsystem.
let registry = prometheus::Registry::new();
monitor_process(&registry).unwrap();
let source_metrics = Arc::new(SourceMetrics::new(registry.clone()));
let hummock_metrics = Arc::new(HummockMetrics::new(registry.clone()));
let streaming_metrics = Arc::new(StreamingMetrics::new(registry.clone()));
Expand Down
4 changes: 4 additions & 0 deletions src/meta/src/rpc/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ impl MetaMetrics {
});
}

pub fn registry(&self) -> &Registry {
&self.registry
}

async fn metrics_service(req: Request<Body>) -> Result<Response<Body>, hyper::Error> {
let meta_metrics = req.extensions().get::<Arc<MetaMetrics>>().unwrap();
let encoder = TextEncoder::new();
Expand Down
2 changes: 2 additions & 0 deletions src/meta/src/rpc/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use itertools::Itertools;
use prost::Message;
use risingwave_common::error::ErrorCode::InternalError;
use risingwave_common::error::{ErrorCode, Result, RwError};
use risingwave_common::monitor::process_linux::monitor_process;
use risingwave_pb::ddl_service::ddl_service_server::DdlServiceServer;
use risingwave_pb::hummock::hummock_manager_service_server::HummockManagerServiceServer;
use risingwave_pb::meta::cluster_service_server::ClusterServiceServer;
Expand Down Expand Up @@ -291,6 +292,7 @@ pub async fn rpc_serve_with_store<S: MetaStore>(
Arc::new(CompactionGroupManager::new(env.clone()).await.unwrap());
let fragment_manager = Arc::new(FragmentManager::new(env.clone()).await.unwrap());
let meta_metrics = Arc::new(MetaMetrics::new());
monitor_process(meta_metrics.registry()).unwrap();
let compactor_manager = Arc::new(hummock::CompactorManager::new());

let cluster_manager = Arc::new(
Expand Down
4 changes: 0 additions & 4 deletions src/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ value-encoding = { path = "../utils/value-encoding" }
workspace-hack = { version = "0.1", path = "../workspace-hack" }
zstd = "0.11.2"

[target.'cfg(target_os = "linux")'.dependencies]
procinfo = { git = "https://github.com/tikv/procinfo-rs", rev = "6599eb9dca74229b2c1fcc44118bef7eff127128" }
procfs = { version = "0.12", default-features = false }

[dev-dependencies]
criterion = "0.3"
risingwave_meta = { path = "../meta", features = ["test"] }
Expand Down
2 changes: 2 additions & 0 deletions src/storage/compactor/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use std::path::PathBuf;
use std::sync::Arc;
use std::time::Duration;

use risingwave_common::monitor::process_linux::monitor_process;
use risingwave_common::service::MetricsManager;
use risingwave_common::util::addr::HostAddr;
use risingwave_object_store::object::parse_remote_object_store;
Expand Down Expand Up @@ -62,6 +63,7 @@ pub async fn compactor_serve(

// Boot compactor
let registry = prometheus::Registry::new();
monitor_process(&registry).unwrap();
let hummock_metrics = Arc::new(HummockMetrics::new(registry.clone()));
let object_metrics = Arc::new(ObjectStoreMetrics::new(registry.clone()));
let hummock_meta_client = Arc::new(MonitoredHummockMetaClient::new(
Expand Down
3 changes: 0 additions & 3 deletions src/storage/src/monitor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,3 @@ pub use hummock_metrics::*;
mod local_metrics;
pub use local_metrics::StoreLocalStatistic;
pub use risingwave_object_store::object::object_metrics::ObjectStoreMetrics;

mod process_linux;
pub use self::process_linux::monitor_process;
2 changes: 0 additions & 2 deletions src/storage/src/monitor/state_store_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use prometheus::{
use risingwave_common::monitor::Print;
use risingwave_hummock_sdk::HummockSSTableId;

use super::monitor_process;
use crate::hummock::sstable_store::SstableStoreRef;
use crate::hummock::{BlockCache, LruCache, Sstable};

Expand Down Expand Up @@ -388,7 +387,6 @@ impl StateStoreMetrics {
)
.unwrap();

monitor_process(&registry).unwrap();
Self {
get_duration,
get_key_size,
Expand Down

0 comments on commit cad79b8

Please sign in to comment.