@@ -29,7 +29,7 @@ const CRITICAL_OP_BUCKETS: &[f64] = &[
29
29
// Metrics collected on operations on the storage repository.
30
30
#[ derive( Debug , EnumVariantNames , IntoStaticStr ) ]
31
31
#[ strum( serialize_all = "kebab_case" ) ]
32
- pub enum StorageTimeOperation {
32
+ pub ( crate ) enum StorageTimeOperation {
33
33
#[ strum( serialize = "layer flush" ) ]
34
34
LayerFlush ,
35
35
@@ -55,7 +55,7 @@ pub enum StorageTimeOperation {
55
55
CreateTenant ,
56
56
}
57
57
58
- pub static STORAGE_TIME_SUM_PER_TIMELINE : Lazy < CounterVec > = Lazy :: new ( || {
58
+ pub ( crate ) static STORAGE_TIME_SUM_PER_TIMELINE : Lazy < CounterVec > = Lazy :: new ( || {
59
59
register_counter_vec ! (
60
60
"pageserver_storage_operations_seconds_sum" ,
61
61
"Total time spent on storage operations with operation, tenant and timeline dimensions" ,
@@ -64,7 +64,7 @@ pub static STORAGE_TIME_SUM_PER_TIMELINE: Lazy<CounterVec> = Lazy::new(|| {
64
64
. expect ( "failed to define a metric" )
65
65
} ) ;
66
66
67
- pub static STORAGE_TIME_COUNT_PER_TIMELINE : Lazy < IntCounterVec > = Lazy :: new ( || {
67
+ pub ( crate ) static STORAGE_TIME_COUNT_PER_TIMELINE : Lazy < IntCounterVec > = Lazy :: new ( || {
68
68
register_int_counter_vec ! (
69
69
"pageserver_storage_operations_seconds_count" ,
70
70
"Count of storage operations with operation, tenant and timeline dimensions" ,
@@ -150,7 +150,7 @@ pub(crate) static MATERIALIZED_PAGE_CACHE_HIT: Lazy<IntCounter> = Lazy::new(|| {
150
150
. expect ( "failed to define a metric" )
151
151
} ) ;
152
152
153
- pub struct PageCacheMetricsForTaskKind {
153
+ pub ( crate ) struct PageCacheMetricsForTaskKind {
154
154
pub read_accesses_materialized_page : IntCounter ,
155
155
pub read_accesses_immutable : IntCounter ,
156
156
@@ -159,7 +159,7 @@ pub struct PageCacheMetricsForTaskKind {
159
159
pub read_hits_materialized_page_older_lsn : IntCounter ,
160
160
}
161
161
162
- pub struct PageCacheMetrics {
162
+ pub ( crate ) struct PageCacheMetrics {
163
163
map : EnumMap < TaskKind , EnumMap < PageContentKind , PageCacheMetricsForTaskKind > > ,
164
164
}
165
165
@@ -181,7 +181,7 @@ static PAGE_CACHE_READ_ACCESSES: Lazy<IntCounterVec> = Lazy::new(|| {
181
181
. expect ( "failed to define a metric" )
182
182
} ) ;
183
183
184
- pub static PAGE_CACHE : Lazy < PageCacheMetrics > = Lazy :: new ( || PageCacheMetrics {
184
+ pub ( crate ) static PAGE_CACHE : Lazy < PageCacheMetrics > = Lazy :: new ( || PageCacheMetrics {
185
185
map : EnumMap :: from_array ( std:: array:: from_fn ( |task_kind| {
186
186
let task_kind = <TaskKind as enum_map:: Enum >:: from_usize ( task_kind) ;
187
187
let task_kind: & ' static str = task_kind. into ( ) ;
@@ -243,10 +243,9 @@ impl PageCacheMetrics {
243
243
}
244
244
}
245
245
246
- pub struct PageCacheSizeMetrics {
246
+ pub ( crate ) struct PageCacheSizeMetrics {
247
247
pub max_bytes : UIntGauge ,
248
248
249
- pub current_bytes_ephemeral : UIntGauge ,
250
249
pub current_bytes_immutable : UIntGauge ,
251
250
pub current_bytes_materialized_page : UIntGauge ,
252
251
}
@@ -260,31 +259,26 @@ static PAGE_CACHE_SIZE_CURRENT_BYTES: Lazy<UIntGaugeVec> = Lazy::new(|| {
260
259
. expect ( "failed to define a metric" )
261
260
} ) ;
262
261
263
- pub static PAGE_CACHE_SIZE : Lazy < PageCacheSizeMetrics > = Lazy :: new ( || PageCacheSizeMetrics {
264
- max_bytes : {
265
- register_uint_gauge ! (
266
- "pageserver_page_cache_size_max_bytes" ,
267
- "Maximum size of the page cache in bytes"
268
- )
269
- . expect ( "failed to define a metric" )
270
- } ,
271
-
272
- current_bytes_ephemeral : {
273
- PAGE_CACHE_SIZE_CURRENT_BYTES
274
- . get_metric_with_label_values ( & [ "ephemeral" ] )
275
- . unwrap ( )
276
- } ,
277
- current_bytes_immutable : {
278
- PAGE_CACHE_SIZE_CURRENT_BYTES
279
- . get_metric_with_label_values ( & [ "immutable" ] )
280
- . unwrap ( )
281
- } ,
282
- current_bytes_materialized_page : {
283
- PAGE_CACHE_SIZE_CURRENT_BYTES
284
- . get_metric_with_label_values ( & [ "materialized_page" ] )
285
- . unwrap ( )
286
- } ,
287
- } ) ;
262
+ pub ( crate ) static PAGE_CACHE_SIZE : Lazy < PageCacheSizeMetrics > =
263
+ Lazy :: new ( || PageCacheSizeMetrics {
264
+ max_bytes : {
265
+ register_uint_gauge ! (
266
+ "pageserver_page_cache_size_max_bytes" ,
267
+ "Maximum size of the page cache in bytes"
268
+ )
269
+ . expect ( "failed to define a metric" )
270
+ } ,
271
+ current_bytes_immutable : {
272
+ PAGE_CACHE_SIZE_CURRENT_BYTES
273
+ . get_metric_with_label_values ( & [ "immutable" ] )
274
+ . unwrap ( )
275
+ } ,
276
+ current_bytes_materialized_page : {
277
+ PAGE_CACHE_SIZE_CURRENT_BYTES
278
+ . get_metric_with_label_values ( & [ "materialized_page" ] )
279
+ . unwrap ( )
280
+ } ,
281
+ } ) ;
288
282
289
283
pub ( crate ) mod page_cache_eviction_metrics {
290
284
use std:: num:: NonZeroUsize ;
@@ -740,13 +734,13 @@ pub(crate) static TENANT: Lazy<TenantMetrics> = Lazy::new(|| {
740
734
741
735
/// Each `Timeline`'s [`EVICTIONS_WITH_LOW_RESIDENCE_DURATION`] metric.
742
736
#[ derive( Debug ) ]
743
- pub struct EvictionsWithLowResidenceDuration {
737
+ pub ( crate ) struct EvictionsWithLowResidenceDuration {
744
738
data_source : & ' static str ,
745
739
threshold : Duration ,
746
740
counter : Option < IntCounter > ,
747
741
}
748
742
749
- pub struct EvictionsWithLowResidenceDurationBuilder {
743
+ pub ( crate ) struct EvictionsWithLowResidenceDurationBuilder {
750
744
data_source : & ' static str ,
751
745
threshold : Duration ,
752
746
}
@@ -1009,7 +1003,7 @@ pub enum SmgrQueryType {
1009
1003
}
1010
1004
1011
1005
#[ derive( Debug ) ]
1012
- pub struct SmgrQueryTimePerTimeline {
1006
+ pub ( crate ) struct SmgrQueryTimePerTimeline {
1013
1007
metrics : [ GlobalAndPerTimelineHistogram ; SmgrQueryType :: COUNT ] ,
1014
1008
}
1015
1009
@@ -1181,8 +1175,8 @@ static COMPUTE_STARTUP_BUCKETS: Lazy<[f64; 28]> = Lazy::new(|| {
1181
1175
. map ( |ms| ( ms as f64 ) / 1000.0 )
1182
1176
} ) ;
1183
1177
1184
- pub struct BasebackupQueryTime ( HistogramVec ) ;
1185
- pub static BASEBACKUP_QUERY_TIME : Lazy < BasebackupQueryTime > = Lazy :: new ( || {
1178
+ pub ( crate ) struct BasebackupQueryTime ( HistogramVec ) ;
1179
+ pub ( crate ) static BASEBACKUP_QUERY_TIME : Lazy < BasebackupQueryTime > = Lazy :: new ( || {
1186
1180
BasebackupQueryTime ( {
1187
1181
register_histogram_vec ! (
1188
1182
"pageserver_basebackup_query_seconds" ,
@@ -1202,7 +1196,7 @@ impl DurationResultObserver for BasebackupQueryTime {
1202
1196
}
1203
1197
}
1204
1198
1205
- pub static LIVE_CONNECTIONS_COUNT : Lazy < IntGaugeVec > = Lazy :: new ( || {
1199
+ pub ( crate ) static LIVE_CONNECTIONS_COUNT : Lazy < IntGaugeVec > = Lazy :: new ( || {
1206
1200
register_int_gauge_vec ! (
1207
1201
"pageserver_live_connections" ,
1208
1202
"Number of live network connections" ,
@@ -1667,7 +1661,7 @@ pub(crate) static WAL_REDO_PROCESS_COUNTERS: Lazy<WalRedoProcessCounters> =
1667
1661
Lazy :: new ( WalRedoProcessCounters :: default) ;
1668
1662
1669
1663
/// Similar to `prometheus::HistogramTimer` but does not record on drop.
1670
- pub struct StorageTimeMetricsTimer {
1664
+ pub ( crate ) struct StorageTimeMetricsTimer {
1671
1665
metrics : StorageTimeMetrics ,
1672
1666
start : Instant ,
1673
1667
}
@@ -1692,7 +1686,7 @@ impl StorageTimeMetricsTimer {
1692
1686
/// Timing facilities for an globally histogrammed metric, which is supported by per tenant and
1693
1687
/// timeline total sum and count.
1694
1688
#[ derive( Clone , Debug ) ]
1695
- pub struct StorageTimeMetrics {
1689
+ pub ( crate ) struct StorageTimeMetrics {
1696
1690
/// Sum of f64 seconds, per operation, tenant_id and timeline_id
1697
1691
timeline_sum : Counter ,
1698
1692
/// Number of oeprations, per operation, tenant_id and timeline_id
@@ -1731,7 +1725,7 @@ impl StorageTimeMetrics {
1731
1725
}
1732
1726
1733
1727
#[ derive( Debug ) ]
1734
- pub struct TimelineMetrics {
1728
+ pub ( crate ) struct TimelineMetrics {
1735
1729
tenant_id : String ,
1736
1730
shard_id : String ,
1737
1731
timeline_id : String ,
@@ -1939,7 +1933,7 @@ impl Drop for PerTimelineRemotePhysicalSizeGauge {
1939
1933
}
1940
1934
}
1941
1935
1942
- pub struct RemoteTimelineClientMetrics {
1936
+ pub ( crate ) struct RemoteTimelineClientMetrics {
1943
1937
tenant_id : String ,
1944
1938
timeline_id : String ,
1945
1939
remote_physical_size_gauge : Mutex < Option < PerTimelineRemotePhysicalSizeGauge > > ,
@@ -2237,7 +2231,7 @@ impl Drop for RemoteTimelineClientMetrics {
2237
2231
2238
2232
/// Wrapper future that measures the time spent by a remote storage operation,
2239
2233
/// and records the time and success/failure as a prometheus metric.
2240
- pub trait MeasureRemoteOp : Sized {
2234
+ pub ( crate ) trait MeasureRemoteOp : Sized {
2241
2235
fn measure_remote_op (
2242
2236
self ,
2243
2237
tenant_id : TenantId ,
@@ -2262,7 +2256,7 @@ pub trait MeasureRemoteOp: Sized {
2262
2256
impl < T : Sized > MeasureRemoteOp for T { }
2263
2257
2264
2258
pin_project ! {
2265
- pub struct MeasuredRemoteOp <F >
2259
+ pub ( crate ) struct MeasuredRemoteOp <F >
2266
2260
{
2267
2261
#[ pin]
2268
2262
inner: F ,
0 commit comments