Find all problematic statics

This commit is contained in:
Bojan Serafimov
2022-08-04 09:30:22 +02:00
parent b4f2c5b514
commit 8173e36a1b
12 changed files with 22 additions and 0 deletions

View File

@@ -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")

View File

@@ -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",

View File

@@ -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",

View File

@@ -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<PageCache> = OnceCell::new();
const TEST_PAGE_CACHE_SIZE: usize = 50;

View File

@@ -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",

View File

@@ -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<SyncQueue> = OnceCell::new();
/// A timeline status to share with pageserver's sync counterpart,

View File

@@ -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",

View File

@@ -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::{

View File

@@ -19,6 +19,7 @@ use tokio::sync::watch;
use tracing::*;
use utils::zid::ZTenantId;
// TODO Add pageserver instance label
static TENANT_TASK_EVENTS: Lazy<IntCounterVec> = 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<mpsc::Sender<ZTenantId>> = OnceCell::new();
static START_COMPACTION_LOOP: OnceCell<mpsc::Sender<ZTenantId>> = OnceCell::new();

View File

@@ -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

View File

@@ -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",

View File

@@ -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")