Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Commit 488613e

Browse files
committed
Add commit latency metrics
1 parent 530da86 commit 488613e

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

common/metrics/metrics.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ var (
2424
MemNodeCount metric.Float64Gauge
2525
}{
2626
RestartLatency: must(meter.Float64Histogram(
27-
"restart_latency_seconds",
27+
"restart_latency",
2828
metric.WithDescription("Time taken to restart the memiavl database"),
2929
metric.WithUnit("s"),
3030
)),
3131
SnapshotCreationLatency: must(meter.Float64Histogram(
32-
"snapshot_creation_latency_seconds",
32+
"snapshot_creation_latency",
3333
metric.WithDescription("Time taken to create memiavl snapshot"),
3434
metric.WithUnit("s"),
3535
)),
3636
CommitLatency: must(meter.Float64Histogram(
37-
"commit_latency_seconds",
37+
"commit_latency",
3838
metric.WithDescription("Time taken to commit"),
39-
metric.WithUnit("s"),
39+
metric.WithUnit("ms"),
4040
)),
4141
MemNodeTotalSize: must(meter.Float64Gauge(
4242
"mem_node_total_size",

sc/memiavl/db.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,10 @@ func (db *DB) pruneSnapshots() {
457457
func (db *DB) Commit() (int64, error) {
458458
db.mtx.Lock()
459459
defer db.mtx.Unlock()
460-
460+
startTime := time.Now()
461+
defer func() {
462+
metrics.SeiDBMetrics.CommitLatency.Record(context.Background(), time.Since(startTime).Seconds())
463+
}()
461464
if db.readOnly {
462465
return 0, errReadOnly
463466
}

0 commit comments

Comments
 (0)