當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Registry.MustAdd方法代碼示例

本文整理匯總了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"),
	}
}
開發者ID:kaustubhkurve,項目名稱:cockroach,代碼行數:28,代碼來源:monitor.go

示例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)
}
開發者ID:yangxuanjia,項目名稱:cockroach,代碼行數:7,代碼來源:clock_offset.go


注:本文中的github.com/cockroachdb/cockroach/util/metric.Registry.MustAdd方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。