Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

store/tikv: remove tidb/metrics from store/tikv #23221

Merged
merged 3 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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