This repository was archived by the owner on Jan 20, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414 SeiDBMetrics = struct {
1515 RestartLatency metric.Float64Histogram
1616 SnapshotCreationLatency metric.Float64Histogram
17- CommitLatency metric.Float64Histogram
17+ CommitLatency metric.Int64Histogram
18+ ApplyChangesetLatency metric.Int64Histogram
1819 MemNodeTotalSize metric.Float64Gauge
1920 MemNodeCount metric.Float64Gauge
2021 }{
@@ -28,11 +29,16 @@ var (
2829 metric .WithDescription ("Time taken to create memiavl snapshot" ),
2930 metric .WithUnit ("s" ),
3031 )),
31- CommitLatency : must (meter .Float64Histogram (
32+ CommitLatency : must (meter .Int64Histogram (
3233 "commit_latency" ,
3334 metric .WithDescription ("Time taken to commit" ),
3435 metric .WithUnit ("ms" ),
3536 )),
37+ ApplyChangesetLatency : must (meter .Int64Histogram (
38+ "apply_changeset_latency" ,
39+ metric .WithDescription ("Time taken to commit" ),
40+ metric .WithUnit ("ms" ),
41+ )),
3642 MemNodeTotalSize : must (meter .Float64Gauge (
3743 "mem_node_total_size" ,
3844 metric .WithDescription ("Time taken to restart the memiavl database" ),
Original file line number Diff line number Diff line change @@ -294,7 +294,10 @@ func (db *DB) ApplyChangeSets(changeSets []*proto.NamedChangeSet) error {
294294
295295 db .mtx .Lock ()
296296 defer db .mtx .Unlock ()
297-
297+ startTime := time .Now ()
298+ defer func () {
299+ metrics .SeiDBMetrics .ApplyChangesetLatency .Record (context .Background (), time .Since (startTime ).Milliseconds ())
300+ }()
298301 if db .readOnly {
299302 return errReadOnly
300303 }
@@ -459,7 +462,7 @@ func (db *DB) Commit() (int64, error) {
459462 defer db .mtx .Unlock ()
460463 startTime := time .Now ()
461464 defer func () {
462- metrics .SeiDBMetrics .CommitLatency .Record (context .Background (), time .Since (startTime ).Seconds ())
465+ metrics .SeiDBMetrics .CommitLatency .Record (context .Background (), time .Since (startTime ).Milliseconds ())
463466 }()
464467 if db .readOnly {
465468 return 0 , errReadOnly
You can’t perform that action at this time.
0 commit comments