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


Golang Registry.Rates方法代碼示例

本文整理匯總了Golang中github.com/cockroachdb/cockroach/util/metric.Registry.Rates方法的典型用法代碼示例。如果您正苦於以下問題:Golang Registry.Rates方法的具體用法?Golang Registry.Rates怎麽用?Golang Registry.Rates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/cockroachdb/cockroach/util/metric.Registry的用法示例。


在下文中一共展示了Registry.Rates方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: makeNodeMetrics

func makeNodeMetrics(reg *metric.Registry) nodeMetrics {
	return nodeMetrics{
		registry: reg,
		latency:  reg.Latency(execLatencyName),
		success:  reg.Rates(execSuccessName),
		err:      reg.Rates(execErrorName),
	}
}
開發者ID:yangxuanjia,項目名稱:cockroach,代碼行數:8,代碼來源:node.go

示例2: makeMetrics

// makeMetrics makes a new metrics object with rates set on the provided
// registry.
func makeMetrics(registry *metric.Registry) metrics {
	return metrics{
		bytesReceived: registry.Rates(BytesReceivedRatesName),
		bytesSent:     registry.Rates(BytesSentRatesName),
		infosReceived: registry.Rates(InfosReceivedRatesName),
		infosSent:     registry.Rates(InfosSentRatesName),
	}
}
開發者ID:yangxuanjia,項目名稱:cockroach,代碼行數:10,代碼來源:gossip.go

示例3: NewTxnMetrics

// NewTxnMetrics returns a new instance of txnMetrics that contains metrics which have
// been registered with the provided Registry.
func NewTxnMetrics(txnRegistry *metric.Registry) *TxnMetrics {
	return &TxnMetrics{
		Aborts:     txnRegistry.Rates(abortsPrefix),
		Commits:    txnRegistry.Rates(commitsPrefix),
		Commits1PC: txnRegistry.Rates(commits1PCPrefix),
		Abandons:   txnRegistry.Rates(abandonsPrefix),
		Durations:  txnRegistry.Latency(durationsPrefix),
		Restarts:   txnRegistry.Histogram(restartsKey, 60*time.Second, 100, 3),
	}
}
開發者ID:petermattis,項目名稱:cockroach,代碼行數:12,代碼來源:txn_coord_sender.go


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