Skip to content

Commit

Permalink
store/tikv: remove tidb/metrics from store/tikv (#23221)
Browse files Browse the repository at this point in the history
  • Loading branch information
aierui committed Mar 12, 2021
1 parent 2258ab7 commit f0ccc57
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
1 change: 0 additions & 1 deletion metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ func RegisterMetrics() {
prometheus.MustRegister(StmtNodeCounter)
prometheus.MustRegister(DbStmtNodeCounter)
prometheus.MustRegister(StoreQueryFeedbackCounter)
prometheus.MustRegister(GetStoreLimitErrorCounter)
prometheus.MustRegister(TimeJumpBackCounter)
prometheus.MustRegister(TransactionDuration)
prometheus.MustRegister(StatementDeadlockDetectDuration)
Expand Down
8 changes: 0 additions & 8 deletions metrics/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ var (
Help: "Counter of storing query feedback.",
}, []string{LblType})

GetStoreLimitErrorCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: "tidb",
Subsystem: "statistics",
Name: "get_store_limit_token_error",
Help: "store token is up to the limit, probably because one of the stores is the hotspot or unavailable",
}, []string{LblAddress, LblStore})

SignificantFeedbackCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: "tidb",
Expand Down
11 changes: 11 additions & 0 deletions store/tikv/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ var (
TiKVNoAvailableConnectionCounter prometheus.Counter
TiKVAsyncCommitTxnCounter *prometheus.CounterVec
TiKVOnePCTxnCounter *prometheus.CounterVec
TiKVStoreLimitErrorCounter *prometheus.CounterVec
)

// Label constants.
Expand All @@ -65,6 +66,7 @@ const (
LblLockKeys = "lock_keys"
LabelBatchRecvLoop = "batch-recv-loop"
LabelBatchSendLoop = "batch-send-loop"
LblAddress = "address"
)

func initMetrics(namespace, subsystem string) {
Expand Down Expand Up @@ -345,6 +347,14 @@ func initMetrics(namespace, subsystem string) {
Help: "Counter of 1PC transactions.",
}, []string{LblType})

TiKVStoreLimitErrorCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "get_store_limit_token_error",
Help: "store token is up to the limit, probably because one of the stores is the hotspot or unavailable",
}, []string{LblAddress, LblStore})

initShortcuts()
}

Expand Down Expand Up @@ -393,4 +403,5 @@ func RegisterMetrics() {
prometheus.MustRegister(TiKVNoAvailableConnectionCounter)
prometheus.MustRegister(TiKVAsyncCommitTxnCounter)
prometheus.MustRegister(TiKVOnePCTxnCounter)
prometheus.MustRegister(TiKVStoreLimitErrorCounter)
}
3 changes: 1 addition & 2 deletions store/tikv/region_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
"github.com/pingcap/kvproto/pkg/errorpb"
"github.com/pingcap/kvproto/pkg/kvrpcpb"
"github.com/pingcap/tidb/kv"
tidbmetrics "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/storeutil"
Expand Down Expand Up @@ -504,7 +503,7 @@ func (s *RegionRequestSender) getStoreToken(st *Store, limit int64) error {
st.tokenCount.Add(1)
return nil
}
tidbmetrics.GetStoreLimitErrorCounter.WithLabelValues(st.addr, strconv.FormatUint(st.storeID, 10)).Inc()
metrics.TiKVStoreLimitErrorCounter.WithLabelValues(st.addr, strconv.FormatUint(st.storeID, 10)).Inc()
return ErrTokenLimit.GenWithStackByArgs(st.storeID)

}
Expand Down

0 comments on commit f0ccc57

Please sign in to comment.