MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / Metrics

Method Metrics

driver/oss/db.go:349–374  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

347}
348
349func (db *DB) Metrics() (tit string, metrics []map[string]any) {
350 tit = "hybriddb cache"
351 costAdd := db.cache.Metrics.CostAdded()
352 costEvicted := db.cache.Metrics.CostEvicted()
353 metrics = []map[string]any{
354 {"used_cost": costAdd - costEvicted}, // Current memory usage (bytes)
355 {"cost_added": costAdd}, // Total memory sum of data added in history, incrementing (bytes)
356 {"cost_evicted": costEvicted}, // Free total memory, incrementing (bytes)
357 {"hits": db.cache.Metrics.Hits()}, // hits
358 {"misses": db.cache.Metrics.Misses()}, // misses
359 {"ratio": fmt.Sprintf("%.2f", db.cache.Metrics.Ratio())}, // hits / (hists + misses)
360 {"keys_added": db.cache.Metrics.KeysAdded()}, // number of keys added
361 {"keys_evicted": db.cache.Metrics.KeysEvicted()}, // delete key times
362 {"keys_updated": db.cache.Metrics.KeysUpdated()}, // update key times
363 {"gets_kept": db.cache.Metrics.GetsKept()}, // get total number of times the command is executed
364 // GetsDropped is the number of Get counter increments that are dropped
365 // internally.
366 {"gets_dropped": db.cache.Metrics.GetsDropped()},
367 // SetsDropped is the number of Set calls that don't make it into internal
368 // buffers (due to contention or some other reason).
369 {"sets_dropped": db.cache.Metrics.SetsDropped()},
370 // SetsRejected is the number of Set calls rejected by the policy (TinyLFU).
371 {"sets_rejected": db.cache.Metrics.SetsRejected()},
372 }
373 return
374}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected