MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / UpdateCalculatedStats

Method UpdateCalculatedStats

db/database_stats.go:25–37  ·  view source on GitHub ↗

Wrapper around *expvars.Map for database stats that provide: - A lazy loading mechanism - Initialize all stats in a stat group to their zero values type DatabaseStats struct { NewStats *base.DbStats } Update database-specific stats that are more efficiently calculated at stats collection time

(ctx context.Context)

Source from the content-addressed store, hash-verified

23
24// Update database-specific stats that are more efficiently calculated at stats collection time
25func (db *DatabaseContext) UpdateCalculatedStats(ctx context.Context) {
26
27 if db == nil || db.DbStats == nil {
28 return
29 }
30 db.changeCache.updateStats(ctx)
31 channelCache := db.changeCache.getChannelCache()
32 if channelCache != nil {
33 db.DbStats.Cache().ChannelCacheMaxEntries.Set(int64(channelCache.MaxCacheSize(ctx)))
34 db.DbStats.Cache().HighSeqCached.Set(int64(channelCache.GetHighCacheSequence()))
35 }
36
37}
38
39// UpdateTotalSyncTimeStat updates the TotalSyncTime to the current value + NumReplicationsActive each time this is called
40func (db *DatabaseContext) UpdateTotalSyncTimeStat() {

Calls 6

updateStatsMethod · 0.80
CacheMethod · 0.80
MaxCacheSizeMethod · 0.65
GetHighCacheSequenceMethod · 0.65
getChannelCacheMethod · 0.45
SetMethod · 0.45