mirror of https://github.com/tikv/client-go.git
Refine the SafeTS gap metric (#90)
Signed-off-by: JmPotato <ghzpotato@gmail.com>
This commit is contained in:
parent
bc884ee6ac
commit
8d4847a868
|
|
@ -60,7 +60,7 @@ var (
|
|||
TiKVForwardRequestCounter *prometheus.CounterVec
|
||||
TiKVTSFutureWaitDuration prometheus.Histogram
|
||||
TiKVSafeTSUpdateCounter *prometheus.CounterVec
|
||||
TiKVSafeTSGapHistogram *prometheus.HistogramVec
|
||||
TiKVMinSafeTSGapSeconds *prometheus.GaugeVec
|
||||
TiKVReplicaSelectorFailureCounter *prometheus.CounterVec
|
||||
TiKVRequestRetryTimesHistogram prometheus.Histogram
|
||||
TiKVTxnCommitBackoffSeconds prometheus.Histogram
|
||||
|
|
@ -429,13 +429,12 @@ func initMetrics(namespace, subsystem string) {
|
|||
Help: "Counter of tikv safe_ts being updated.",
|
||||
}, []string{LblResult, LblStore})
|
||||
|
||||
TiKVSafeTSGapHistogram = prometheus.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
TiKVMinSafeTSGapSeconds = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
Namespace: namespace,
|
||||
Subsystem: subsystem,
|
||||
Name: "safets_gap_seconds",
|
||||
Help: "Histogram of the gap between SafeTS and current time.",
|
||||
Buckets: prometheus.ExponentialBuckets(0.001, 2.0, 24),
|
||||
Name: "min_safets_gap_seconds",
|
||||
Help: "The minimal (non-zero) SafeTS gap for each store.",
|
||||
}, []string{LblStore})
|
||||
|
||||
TiKVReplicaSelectorFailureCounter = prometheus.NewCounterVec(
|
||||
|
|
@ -536,7 +535,7 @@ func RegisterMetrics() {
|
|||
prometheus.MustRegister(TiKVForwardRequestCounter)
|
||||
prometheus.MustRegister(TiKVTSFutureWaitDuration)
|
||||
prometheus.MustRegister(TiKVSafeTSUpdateCounter)
|
||||
prometheus.MustRegister(TiKVSafeTSGapHistogram)
|
||||
prometheus.MustRegister(TiKVMinSafeTSGapSeconds)
|
||||
prometheus.MustRegister(TiKVReplicaSelectorFailureCounter)
|
||||
prometheus.MustRegister(TiKVRequestRetryTimesHistogram)
|
||||
prometheus.MustRegister(TiKVTxnCommitBackoffSeconds)
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ func (s *KVStore) updateSafeTS(ctx context.Context) {
|
|||
s.setSafeTS(storeID, safeTS)
|
||||
metrics.TiKVSafeTSUpdateCounter.WithLabelValues("success", storeIDStr).Inc()
|
||||
safeTSTime := oracle.GetTimeFromTS(safeTS)
|
||||
metrics.TiKVSafeTSGapHistogram.WithLabelValues(storeIDStr).Observe(time.Since(safeTSTime).Seconds())
|
||||
metrics.TiKVMinSafeTSGapSeconds.WithLabelValues(storeIDStr).Set(time.Since(safeTSTime).Seconds())
|
||||
}(ctx, wg, storeID, storeAddr)
|
||||
}
|
||||
wg.Wait()
|
||||
|
|
|
|||
Loading…
Reference in New Issue