Skip to content

Commit

Permalink
store/tikv: remove tidb/metrics from store/tikv/oracles (pingcap#23418)
Browse files Browse the repository at this point in the history
  • Loading branch information
aierui authored Mar 23, 2021
1 parent d7883fe commit e6576d4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 33 deletions.
1 change: 0 additions & 1 deletion metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ func RegisterMetrics() {
prometheus.MustRegister(GCRegionTooManyLocksCounter)
prometheus.MustRegister(GCWorkerCounter)
prometheus.MustRegister(GCUnsafeDestroyRangeFailuresCounterVec)
prometheus.MustRegister(TSFutureWaitDuration)
prometheus.MustRegister(TotalQueryProcHistogram)
prometheus.MustRegister(TotalCopProcHistogram)
prometheus.MustRegister(TotalCopWaitHistogram)
Expand Down
30 changes: 0 additions & 30 deletions metrics/oracles.go

This file was deleted.

11 changes: 11 additions & 0 deletions store/tikv/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var (
TiKVGRPCConnTransientFailureCounter *prometheus.CounterVec
TiKVPanicCounter *prometheus.CounterVec
TiKVForwardRequestCounter *prometheus.CounterVec
TiKVTSFutureWaitDuration prometheus.Histogram
)

// Label constants.
Expand Down Expand Up @@ -384,6 +385,15 @@ func initMetrics(namespace, subsystem string) {
Help: "Counter of tikv request being forwarded through another node",
}, []string{LblFromStore, LblToStore, LblType, LblResult})

TiKVTSFutureWaitDuration = prometheus.NewHistogram(
prometheus.HistogramOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "ts_future_wait_seconds",
Help: "Bucketed histogram of seconds cost for waiting timestamp future.",
Buckets: prometheus.ExponentialBuckets(0.000005, 2, 30), // 5us ~ 2560s
})

initShortcuts()
}

Expand Down Expand Up @@ -436,4 +446,5 @@ func RegisterMetrics() {
prometheus.MustRegister(TiKVGRPCConnTransientFailureCounter)
prometheus.MustRegister(TiKVPanicCounter)
prometheus.MustRegister(TiKVForwardRequestCounter)
prometheus.MustRegister(TiKVTSFutureWaitDuration)
}
4 changes: 2 additions & 2 deletions store/tikv/oracle/oracles/pd.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"time"

"github.com/pingcap/errors"
"github.com/pingcap/tidb/metrics"
"github.com/pingcap/tidb/store/tikv/logutil"
"github.com/pingcap/tidb/store/tikv/metrics"
"github.com/pingcap/tidb/store/tikv/oracle"
pd "github.com/tikv/pd/client"
"go.uber.org/zap"
Expand Down Expand Up @@ -93,7 +93,7 @@ type tsFuture struct {
func (f *tsFuture) Wait() (uint64, error) {
now := time.Now()
physical, logical, err := f.TSFuture.Wait()
metrics.TSFutureWaitDuration.Observe(time.Since(now).Seconds())
metrics.TiKVTSFutureWaitDuration.Observe(time.Since(now).Seconds())
if err != nil {
return 0, errors.Trace(err)
}
Expand Down

0 comments on commit e6576d4

Please sign in to comment.