12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
14
15
- use std:: borrow:: Cow ;
15
+ use std:: { borrow:: Cow , fmt :: Debug } ;
16
16
17
17
use mixtrics:: metrics:: { BoxedCounter , BoxedGauge , BoxedHistogram , BoxedRegistry } ;
18
18
19
19
#[ expect( missing_docs) ]
20
- #[ derive( Debug ) ]
21
20
pub struct Metrics {
22
21
/* in-memory cache metrics */
23
22
pub memory_insert : BoxedCounter ,
@@ -68,6 +67,8 @@ pub struct Metrics {
68
67
pub storage_entry_serialize_duration : BoxedHistogram ,
69
68
pub storage_entry_deserialize_duration : BoxedHistogram ,
70
69
70
+ pub storage_blob_efficiency : BoxedHistogram ,
71
+
71
72
/* hybrid cache metrics */
72
73
pub hybrid_insert : BoxedCounter ,
73
74
pub hybrid_hit : BoxedCounter ,
@@ -81,6 +82,12 @@ pub struct Metrics {
81
82
pub hybrid_fetch_duration : BoxedHistogram ,
82
83
}
83
84
85
+ impl Debug for Metrics {
86
+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
87
+ f. debug_struct ( "Metrics" ) . finish ( )
88
+ }
89
+ }
90
+
84
91
impl Metrics {
85
92
/// Create a new metric with the given name.
86
93
pub fn new ( name : impl Into < Cow < ' static , str > > , registry : & BoxedRegistry ) -> Self {
@@ -169,6 +176,12 @@ impl Metrics {
169
176
& [ "name" , "op" ] ,
170
177
) ;
171
178
179
+ let foyer_storage_blob_efficiency = registry. register_histogram_vec (
180
+ "foyer_storage_blob_efficiency" . into ( ) ,
181
+ "foyer large object disk cache entry count in a blob" . into ( ) ,
182
+ & [ "name" ] ,
183
+ ) ;
184
+
172
185
let storage_enqueue = foyer_storage_op_total. counter ( & [ name. clone ( ) , "enqueue" . into ( ) ] ) ;
173
186
let storage_hit = foyer_storage_op_total. counter ( & [ name. clone ( ) , "hit" . into ( ) ] ) ;
174
187
let storage_miss = foyer_storage_op_total. counter ( & [ name. clone ( ) , "miss" . into ( ) ] ) ;
@@ -207,6 +220,8 @@ impl Metrics {
207
220
let storage_entry_deserialize_duration =
208
221
foyer_storage_entry_serde_duration. histogram ( & [ name. clone ( ) , "deserialize" . into ( ) ] ) ;
209
222
223
+ let storage_blob_efficiency = foyer_storage_blob_efficiency. histogram ( & [ name. clone ( ) ] ) ;
224
+
210
225
/* hybrid cache metrics */
211
226
212
227
let foyer_hybrid_op_total = registry. register_counter_vec (
@@ -269,6 +284,7 @@ impl Metrics {
269
284
storage_region_size_bytes,
270
285
storage_entry_serialize_duration,
271
286
storage_entry_deserialize_duration,
287
+ storage_blob_efficiency,
272
288
273
289
hybrid_insert,
274
290
hybrid_hit,
0 commit comments