本文整理汇总了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),
}
}