本文整理匯總了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),
}
}
示例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),
}
}
示例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),
}
}