From 286c9743c770cda95ee5fe3d3c3ca766c860a9d7 Mon Sep 17 00:00:00 2001 From: Maggie Zhou Date: Sat, 6 Jun 2020 19:26:54 -0700 Subject: [PATCH 1/3] Add more labels to VReplicationSecondsBehindMaster. Signed-off-by: Maggie Zhou --- go/vt/vttablet/tabletmanager/vreplication/stats.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/go/vt/vttablet/tabletmanager/vreplication/stats.go b/go/vt/vttablet/tabletmanager/vreplication/stats.go index a13b1e2e549..c45aac70ece 100644 --- a/go/vt/vttablet/tabletmanager/vreplication/stats.go +++ b/go/vt/vttablet/tabletmanager/vreplication/stats.go @@ -61,13 +61,14 @@ func (st *vrStats) register() { stats.NewGaugesFuncWithMultiLabels( "VReplicationSecondsBehindMaster", "vreplication seconds behind master per stream", - []string{"counts"}, + []string{"counts", "workflow", "source"}, func() map[string]int64 { st.mu.Lock() defer st.mu.Unlock() result := make(map[string]int64, len(st.controllers)) for _, ct := range st.controllers { - result[fmt.Sprintf("%v", ct.id)] = ct.blpStats.SecondsBehindMaster.Get() + source := ct.source.Keyspace + "/" + ct.source.Shard + result[fmt.Sprintf("%v", ct.id)+"."+ct.workflow+"."+source] = ct.blpStats.SecondsBehindMaster.Get() } return result }) From 8e7c95c3dbdf2a1c529c3827b72129f1e35608e0 Mon Sep 17 00:00:00 2001 From: Maggie Zhou Date: Sat, 6 Jun 2020 19:31:15 -0700 Subject: [PATCH 2/3] Actually split up source shard / source keyspace Signed-off-by: Maggie Zhou --- go/vt/vttablet/tabletmanager/vreplication/stats.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/go/vt/vttablet/tabletmanager/vreplication/stats.go b/go/vt/vttablet/tabletmanager/vreplication/stats.go index c45aac70ece..21fd6b2aa96 100644 --- a/go/vt/vttablet/tabletmanager/vreplication/stats.go +++ b/go/vt/vttablet/tabletmanager/vreplication/stats.go @@ -61,14 +61,13 @@ func (st *vrStats) register() { stats.NewGaugesFuncWithMultiLabels( "VReplicationSecondsBehindMaster", "vreplication seconds behind master per stream", - []string{"counts", "workflow", "source"}, + []string{"counts", "workflow", "source_keyspace", "source_shard"}, func() map[string]int64 { st.mu.Lock() defer st.mu.Unlock() result := make(map[string]int64, len(st.controllers)) for _, ct := range st.controllers { - source := ct.source.Keyspace + "/" + ct.source.Shard - result[fmt.Sprintf("%v", ct.id)+"."+ct.workflow+"."+source] = ct.blpStats.SecondsBehindMaster.Get() + result[fmt.Sprintf("%v", ct.id)+"."+ct.workflow+"."+ct.source.Keyspace+"."+ct.source.Shard] = ct.blpStats.SecondsBehindMaster.Get() } return result }) From bb0909451f75f25e832a493354dd80398e1af8d1 Mon Sep 17 00:00:00 2001 From: Maggie Zhou Date: Sat, 6 Jun 2020 19:51:06 -0700 Subject: [PATCH 3/3] Reorder new labels. Signed-off-by: Maggie Zhou --- go/vt/vttablet/tabletmanager/vreplication/stats.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go/vt/vttablet/tabletmanager/vreplication/stats.go b/go/vt/vttablet/tabletmanager/vreplication/stats.go index 21fd6b2aa96..24b5ff960dc 100644 --- a/go/vt/vttablet/tabletmanager/vreplication/stats.go +++ b/go/vt/vttablet/tabletmanager/vreplication/stats.go @@ -61,13 +61,13 @@ func (st *vrStats) register() { stats.NewGaugesFuncWithMultiLabels( "VReplicationSecondsBehindMaster", "vreplication seconds behind master per stream", - []string{"counts", "workflow", "source_keyspace", "source_shard"}, + []string{"source_keyspace", "source_shard", "workflow", "counts"}, func() map[string]int64 { st.mu.Lock() defer st.mu.Unlock() result := make(map[string]int64, len(st.controllers)) for _, ct := range st.controllers { - result[fmt.Sprintf("%v", ct.id)+"."+ct.workflow+"."+ct.source.Keyspace+"."+ct.source.Shard] = ct.blpStats.SecondsBehindMaster.Get() + result[ct.source.Keyspace+"."+ct.source.Shard+"."+ct.workflow+"."+fmt.Sprintf("%v", ct.id)] = ct.blpStats.SecondsBehindMaster.Get() } return result })