本文整理匯總了Golang中github.com/cockroachdb/cockroach/util/metric.Registry.MustAdd方法的典型用法代碼示例。如果您正苦於以下問題:Golang Registry.MustAdd方法的具體用法?Golang Registry.MustAdd怎麽用?Golang Registry.MustAdd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cockroachdb/cockroach/util/metric.Registry
的用法示例。
在下文中一共展示了Registry.MustAdd方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewStoreStatusMonitor
// 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"),
}
}
示例2: RegisterMetrics
// 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)
}