Skip to content

Commit f8bf3dd

Browse files
authored
improve region request log for diagnose (#1300) (#1328)
* improve region request log for diagnose * rename struct * refine region error metric with store id label and add rpc error metric * refine comment * refine code * restrict log * refine code * refine * refine * refine log * refine code * fix test * address comment * refine * refine * refine log --------- Signed-off-by: crazycs520 <[email protected]>
1 parent 6b7d200 commit f8bf3dd

File tree

10 files changed

+386
-119
lines changed

10 files changed

+386
-119
lines changed

integration_tests/main_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func TestMain(m *testing.M) {
2727
opts := []goleak.Option{
2828
goleak.IgnoreTopFunction("github.com/pingcap/goleveldb/leveldb.(*DB).mpoolDrain"),
2929
goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/txnkv/transaction.keepAlive"), // TODO: fix ttlManager goroutine leak
30+
goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/config/retry.(*Config).createBackoffFn.newBackoffFn.func2"),
3031
}
3132

3233
goleak.VerifyTestMain(m, opts...)

integration_tests/snapshot_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,13 @@ func (s *testSnapshotSuite) TestSnapshotThreadSafe() {
303303

304304
func (s *testSnapshotSuite) TestSnapshotRuntimeStats() {
305305
reqStats := tikv.NewRegionRequestRuntimeStats()
306-
tikv.RecordRegionRequestRuntimeStats(reqStats.Stats, tikvrpc.CmdGet, time.Second)
307-
tikv.RecordRegionRequestRuntimeStats(reqStats.Stats, tikvrpc.CmdGet, time.Millisecond)
306+
reqStats.RecordRPCRuntimeStats(tikvrpc.CmdGet, time.Second)
307+
reqStats.RecordRPCRuntimeStats(tikvrpc.CmdGet, time.Millisecond)
308308
snapshot := s.store.GetSnapshot(0)
309309
runtimeStats := &txnkv.SnapshotRuntimeStats{}
310310
snapshot.SetRuntimeStats(runtimeStats)
311-
snapshot.MergeRegionRequestStats(reqStats.Stats)
312-
snapshot.MergeRegionRequestStats(reqStats.Stats)
311+
snapshot.MergeRegionRequestStats(reqStats)
312+
snapshot.MergeRegionRequestStats(reqStats)
313313
bo := tikv.NewBackofferWithVars(context.Background(), 2000, nil)
314314
err := bo.BackoffWithMaxSleepTxnLockFast(5, errors.New("test"))
315315
s.Nil(err)

0 commit comments

Comments
 (0)