MCPcopy
hub / github.com/canopy-network/canopy / UpdateStoreMetrics

Method UpdateStoreMetrics

lib/metrics.go:640–663  ·  view source on GitHub ↗

UpdateStoreMetrics() updates the store telemetry

(size, entries int64, startTime time.Time, startFlushTime time.Time)

Source from the content-addressed store, hash-verified

638
639// UpdateStoreMetrics() updates the store telemetry
640func (m *Metrics) UpdateStoreMetrics(size, entries int64, startTime time.Time, startFlushTime time.Time) {
641 // exit if empty
642 if m == nil {
643 return
644 }
645 // update the partition metrics
646 if !startTime.IsZero() {
647 // updates the size in bytes
648 m.DBPartitionSize.Set(float64(size))
649 // updates the number of entries
650 m.DBPartitionEntries.Set(float64(entries))
651 // update the processing time in seconds
652 m.DBFlushPartitionTime.Observe(time.Since(startFlushTime).Seconds())
653 // update the processing time in seconds
654 m.DBPartitionTime.Observe(time.Since(startTime).Seconds())
655 } else {
656 // updates the size in bytes
657 m.DBCommitSize.Set(float64(size))
658 // updates the number of entries
659 m.DBCommitEntries.Set(float64(entries))
660 // update the processing time in seconds
661 m.DBCommitTime.Observe(time.Since(startFlushTime).Seconds())
662 }
663}
664
665// UpdateBlockMetrics() updates the metrics about the last block
666func (m *Metrics) UpdateBlockMetrics(proposerAddress []byte, blockSize, txCount, vdfIterations uint64, duration time.Duration) {

Callers 1

CommitMethod · 0.80

Calls 1

SetMethod · 0.65

Tested by

no test coverage detected