Skip to content

Commit

Permalink
metrics,store: add a metric for ttlManager to record the lifet… (#14300)
Browse files Browse the repository at this point in the history
  • Loading branch information
sre-bot authored and zz-jason committed Jan 7, 2020
1 parent ca3e7ec commit 00f0015
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,5 @@ func RegisterMetrics() {
prometheus.MustRegister(TiKVTxnHeartBeatHistogram)
prometheus.MustRegister(TiKVPessimisticLockKeysDuration)
prometheus.MustRegister(GRPCConnTransientFailureCounter)
prometheus.MustRegister(TiKVTTLLifeTimeReachCounter)
}
8 changes: 8 additions & 0 deletions metrics/tikvclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,12 @@ var (
Buckets: prometheus.ExponentialBuckets(0.001, 2, 24), // 1ms ~ 16777s
Help: "tidb txn pessimistic lock keys duration",
})

TiKVTTLLifeTimeReachCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: "tidb",
Subsystem: "tikvclient",
Name: "ttl_lifetime_reach_total",
Help: "Counter of ttlManager live too long.",
})
)
1 change: 1 addition & 0 deletions store/tikv/2pc.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ func (tm *ttlManager) keepAlive(c *twoPhaseCommitter) {
// the key will not be locked forever.
logutil.Logger(context.Background()).Info("ttlManager live up to its lifetime",
zap.Uint64("txnStartTS", c.startTS))
metrics.TiKVTTLLifeTimeReachCounter.Inc()
return
}

Expand Down

0 comments on commit 00f0015

Please sign in to comment.