@@ -249,13 +249,25 @@ func (e *Exporter) handleMetricsReplication(ch chan<- prometheus.Metric, masterH
249
249
}
250
250
251
251
func (e * Exporter ) handleMetricsRocksDB (ch chan <- prometheus.Metric , fieldKey string , fieldValue string ) {
252
+ sharedMetric := []string {"block_cache_usage" }
253
+ for _ , field := range sharedMetric {
254
+ // format like `block_cache_usage:0`
255
+ if strings .Compare (fieldKey , field ) == 0 {
256
+ if statValue , err := strconv .ParseFloat (fieldValue , 64 ); err == nil {
257
+ e .registerConstMetricGauge (ch , fieldKey , statValue , "-" )
258
+ }
259
+ // return ASAP
260
+ return
261
+ }
262
+ }
263
+
252
264
prefixs := []string {
253
265
"block_cache_usage" , "block_cache_pinned_usage" , "index_and_filter_cache_usage" , "estimate_keys" ,
254
266
"level0_file_limit_slowdown" , "level0_file_limit_stop" , "pending_compaction_bytes_slowdown" ,
255
267
"pending_compaction_bytes_stop" , "memtable_count_limit_slowdown" , "memtable_count_limit_stop" ,
256
268
}
257
269
for _ , prefix := range prefixs {
258
- // format like `block_cache_usage [default]:0`
270
+ // format like `estimate_keys [default]:0`
259
271
if strings .HasPrefix (fieldKey , prefix ) {
260
272
fields := strings .Split (fieldKey , "[" )
261
273
if len (fields ) != 2 {
@@ -266,6 +278,7 @@ func (e *Exporter) handleMetricsRocksDB(ch chan<- prometheus.Metric, fieldKey st
266
278
if statValue , err := strconv .ParseFloat (fieldValue , 64 ); err == nil {
267
279
e .registerConstMetricGauge (ch , metricName , statValue , columnFamily )
268
280
}
281
+ return
269
282
}
270
283
}
271
284
}
0 commit comments