Ejemplo n.º 1
0
func makeNodeMetrics(reg *metric.Registry) nodeMetrics {
	return nodeMetrics{
		registry: reg,
		latency:  reg.Latency(execLatencyName),
		success:  reg.Rates(execSuccessName),
		err:      reg.Rates(execErrorName),
	}
}
Ejemplo n.º 2
0
// 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),
	}
}
Ejemplo n.º 3
0
// 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),
	}
}