From 8173e36a1b3700332ef367083792b348af904e41 Mon Sep 17 00:00:00 2001 From: Bojan Serafimov Date: Thu, 4 Aug 2022 09:30:22 +0200 Subject: [PATCH] Find all problematic statics --- pageserver/src/layered_repository/layer_map.rs | 1 + pageserver/src/layered_repository/timeline.rs | 6 ++++++ pageserver/src/lib.rs | 1 + pageserver/src/page_cache.rs | 1 + pageserver/src/page_service.rs | 1 + pageserver/src/storage_sync.rs | 2 ++ pageserver/src/storage_sync/upload.rs | 1 + pageserver/src/tenant_mgr.rs | 1 + pageserver/src/tenant_tasks.rs | 2 ++ pageserver/src/thread_mgr.rs | 1 + pageserver/src/virtual_file.rs | 3 +++ pageserver/src/walredo.rs | 2 ++ 12 files changed, 22 insertions(+) diff --git a/pageserver/src/layered_repository/layer_map.rs b/pageserver/src/layered_repository/layer_map.rs index be590c88c2..dee28f3206 100644 --- a/pageserver/src/layered_repository/layer_map.rs +++ b/pageserver/src/layered_repository/layer_map.rs @@ -23,6 +23,7 @@ use std::sync::Arc; use tracing::*; use utils::lsn::Lsn; +// TODO Add pageserver instance label lazy_static! { static ref NUM_ONDISK_LAYERS: IntGauge = register_int_gauge!("pageserver_ondisk_layers", "Number of layers on-disk") diff --git a/pageserver/src/layered_repository/timeline.rs b/pageserver/src/layered_repository/timeline.rs index 6ed1efd3d1..70c0429491 100644 --- a/pageserver/src/layered_repository/timeline.rs +++ b/pageserver/src/layered_repository/timeline.rs @@ -59,6 +59,7 @@ use crate::CheckpointConfig; use crate::{page_cache, storage_sync}; // Metrics collected on operations on the storage repository. +// TODO Add pageserver instance label lazy_static! { pub static ref STORAGE_TIME: HistogramVec = register_histogram_vec!( "pageserver_storage_operations_seconds", @@ -69,6 +70,7 @@ lazy_static! { } // Metrics collected on operations on the storage repository. +// TODO Add pageserver instance label lazy_static! { static ref RECONSTRUCT_TIME: HistogramVec = register_histogram_vec!( "pageserver_getpage_reconstruct_seconds", @@ -78,6 +80,7 @@ lazy_static! { .expect("failed to define a metric"); } +// TODO Add pageserver instance label lazy_static! { static ref MATERIALIZED_PAGE_CACHE_HIT: IntCounterVec = register_int_counter_vec!( "pageserver_materialized_cache_hits_total", @@ -93,6 +96,7 @@ lazy_static! { .expect("failed to define a metric"); } +// TODO Add pageserver instance label lazy_static! { static ref LAST_RECORD_LSN: IntGaugeVec = register_int_gauge_vec!( "pageserver_last_record_lsn", @@ -105,6 +109,7 @@ lazy_static! { // Metrics for determining timeline's physical size. // A layered timeline's physical is defined as the total size of // (delta/image) layer files on disk. +// TODO Add pageserver instance label lazy_static! { static ref CURRENT_PHYSICAL_SIZE: UIntGaugeVec = register_uint_gauge_vec!( "pageserver_current_physical_size", @@ -116,6 +121,7 @@ lazy_static! { // Metrics for cloud upload. These metrics reflect data uploaded to cloud storage, // or in testing they estimate how much we would upload if we did. +// TODO Add pageserver instance label lazy_static! { static ref NUM_PERSISTENT_FILES_CREATED: IntCounter = register_int_counter!( "pageserver_created_persistent_files_total", diff --git a/pageserver/src/lib.rs b/pageserver/src/lib.rs index 4ecb181553..97d50544aa 100644 --- a/pageserver/src/lib.rs +++ b/pageserver/src/lib.rs @@ -42,6 +42,7 @@ pub const STORAGE_FORMAT_VERSION: u16 = 3; pub const IMAGE_FILE_MAGIC: u16 = 0x5A60; pub const DELTA_FILE_MAGIC: u16 = 0x5A61; +// TODO Add pageserver instance label lazy_static! { static ref LIVE_CONNECTIONS_COUNT: IntGaugeVec = register_int_gauge_vec!( "pageserver_live_connections", diff --git a/pageserver/src/page_cache.rs b/pageserver/src/page_cache.rs index 716df0f749..2b35b325c0 100644 --- a/pageserver/src/page_cache.rs +++ b/pageserver/src/page_cache.rs @@ -55,6 +55,7 @@ use utils::{ use crate::layered_repository::writeback_ephemeral_file; use crate::repository::Key; +// TODO move ownership into a new PageserverState struct static PAGE_CACHE: OnceCell = OnceCell::new(); const TEST_PAGE_CACHE_SIZE: usize = 50; diff --git a/pageserver/src/page_service.rs b/pageserver/src/page_service.rs index c8aa4b35e8..839f8e0103 100644 --- a/pageserver/src/page_service.rs +++ b/pageserver/src/page_service.rs @@ -434,6 +434,7 @@ const TIME_BUCKETS: &[f64] = &[ 0.1, // 1/10 s ]; +// TODO Add pageserver instance label lazy_static! { static ref SMGR_QUERY_TIME: HistogramVec = register_histogram_vec!( "pageserver_smgr_query_seconds", diff --git a/pageserver/src/storage_sync.rs b/pageserver/src/storage_sync.rs index c60d3dccc0..0824aabcad 100644 --- a/pageserver/src/storage_sync.rs +++ b/pageserver/src/storage_sync.rs @@ -193,6 +193,7 @@ use self::download::download_index_parts; pub use self::download::gather_tenant_timelines_index_parts; pub use self::download::TEMP_DOWNLOAD_EXTENSION; +// TODO Add pageserver instance label lazy_static! { static ref REMAINING_SYNC_ITEMS: IntGauge = register_int_gauge!( "pageserver_remote_storage_remaining_sync_items", @@ -220,6 +221,7 @@ lazy_static! { .expect("failed to register pageserver remote index upload vec"); } +// TODO move ownership into a new PageserverState struct static SYNC_QUEUE: OnceCell = OnceCell::new(); /// A timeline status to share with pageserver's sync counterpart, diff --git a/pageserver/src/storage_sync/upload.rs b/pageserver/src/storage_sync/upload.rs index f9ab3b7471..3808494ed0 100644 --- a/pageserver/src/storage_sync/upload.rs +++ b/pageserver/src/storage_sync/upload.rs @@ -20,6 +20,7 @@ use crate::{ }; use metrics::{register_int_counter_vec, IntCounterVec}; +// TODO Add pageserver instance label lazy_static! { static ref NO_LAYERS_UPLOAD: IntCounterVec = register_int_counter_vec!( "pageserver_remote_storage_no_layers_uploads_total", diff --git a/pageserver/src/tenant_mgr.rs b/pageserver/src/tenant_mgr.rs index dfdbc4c318..e345a3b343 100644 --- a/pageserver/src/tenant_mgr.rs +++ b/pageserver/src/tenant_mgr.rs @@ -25,6 +25,7 @@ use utils::lsn::Lsn; use utils::zid::{ZTenantId, ZTenantTimelineId, ZTimelineId}; +// TODO move ownership into a new PageserverState struct mod tenants_state { use anyhow::ensure; use std::{ diff --git a/pageserver/src/tenant_tasks.rs b/pageserver/src/tenant_tasks.rs index e51744d3cc..062eb0a454 100644 --- a/pageserver/src/tenant_tasks.rs +++ b/pageserver/src/tenant_tasks.rs @@ -19,6 +19,7 @@ use tokio::sync::watch; use tracing::*; use utils::zid::ZTenantId; +// TODO Add pageserver instance label static TENANT_TASK_EVENTS: Lazy = Lazy::new(|| { register_int_counter_vec!( "pageserver_tenant_task_events", @@ -87,6 +88,7 @@ async fn compaction_loop(tenantid: ZTenantId, mut cancel: watch::Receiver<()>) { ); } +// TODO move ownership into a new PageserverState struct static START_GC_LOOP: OnceCell> = OnceCell::new(); static START_COMPACTION_LOOP: OnceCell> = OnceCell::new(); diff --git a/pageserver/src/thread_mgr.rs b/pageserver/src/thread_mgr.rs index 6dd2e4b00b..bafb0c87d8 100644 --- a/pageserver/src/thread_mgr.rs +++ b/pageserver/src/thread_mgr.rs @@ -51,6 +51,7 @@ use utils::zid::{ZTenantId, ZTimelineId}; use crate::shutdown_pageserver; +// TODO move ownership into a new PageserverState struct lazy_static! { /// Each thread that we track is associated with a "thread ID". It's just /// an increasing number that we assign, not related to any system thread diff --git a/pageserver/src/virtual_file.rs b/pageserver/src/virtual_file.rs index a16e772238..fd1bb54c72 100644 --- a/pageserver/src/virtual_file.rs +++ b/pageserver/src/virtual_file.rs @@ -32,6 +32,7 @@ const STORAGE_IO_TIME_BUCKETS: &[f64] = &[ 1.0, // 1 sec ]; +// TODO Add pageserver instance label lazy_static! { static ref STORAGE_IO_TIME: HistogramVec = register_histogram_vec!( "pageserver_io_operations_seconds", @@ -41,6 +42,8 @@ lazy_static! { ) .expect("failed to define a metric"); } + +// TODO Add pageserver instance label lazy_static! { static ref STORAGE_IO_SIZE: IntGaugeVec = register_int_gauge_vec!( "pageserver_io_operations_bytes_total", diff --git a/pageserver/src/walredo.rs b/pageserver/src/walredo.rs index db4620417c..9f0652a27a 100644 --- a/pageserver/src/walredo.rs +++ b/pageserver/src/walredo.rs @@ -105,6 +105,8 @@ impl crate::walredo::WalRedoManager for DummyRedoManager { // We collect the time spent in actual WAL redo ('redo'), and time waiting // for access to the postgres process ('wait') since there is only one for // each tenant. +// +// TODO Add pageserver instance label lazy_static! { static ref WAL_REDO_TIME: Histogram = register_histogram!("pageserver_wal_redo_seconds", "Time spent on WAL redo")