// NewStoreStatusMonitor constructs a StoreStatusMonitor with the given ID. func NewStoreStatusMonitor(id roachpb.StoreID, metaRegistry *metric.Registry) *StoreStatusMonitor { registry := metric.NewRegistry() // Format as `cr.store.<metric>.<id>` in output, in analogy to the time // series data written. metaRegistry.MustAdd(storeTimeSeriesPrefix+"%s."+id.String(), registry) return &StoreStatusMonitor{ ID: id, registry: registry, rangeCount: registry.Counter("ranges"), leaderRangeCount: registry.Gauge("ranges.leader"), replicatedRangeCount: registry.Gauge("ranges.replicated"), availableRangeCount: registry.Gauge("ranges.available"), liveBytes: registry.Gauge("livebytes"), keyBytes: registry.Gauge("keybytes"), valBytes: registry.Gauge("valbytes"), intentBytes: registry.Gauge("intentbytes"), liveCount: registry.Gauge("livecount"), keyCount: registry.Gauge("keycount"), valCount: registry.Gauge("valcount"), intentCount: registry.Gauge("intentcount"), intentAge: registry.Gauge("intentage"), gcBytesAge: registry.Gauge("gcbytesage"), lastUpdateNanos: registry.Gauge("lastupdatenanos"), capacity: registry.Gauge("capacity"), available: registry.Gauge("capacity.available"), } }
// RegisterMetrics adds the local metrics to a registry. // TODO(marc): this pattern deviates from other users of the registry // that take it as an argument at metric construction time. func (r *RemoteClockMonitor) RegisterMetrics(reg *metric.Registry) { reg.MustAdd(clusterOffsetLowerBoundName, r.metrics.clusterOffsetLowerBound) reg.MustAdd(clusterOffsetUpperBoundName, r.metrics.clusterOffsetUpperBound) }