Skip to content

Commit 31b9e0e

Browse files
committed
allow skipping metrics registration
Signed-off-by: Mohamed Hamza <[email protected]>
1 parent ce060d3 commit 31b9e0e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

go/vt/vttablet/tabletserver/gc/tablegc.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func NewTableGC(env tabletenv.Env, ts *topo.Server, lagThrottler *throttle.Throt
144144

145145
env: env,
146146
ts: ts,
147-
pool: newPool(env),
147+
pool: newPool(env, "TableGCPool"),
148148

149149
purgingTables: map[string]bool{},
150150
checkRequestChan: make(chan bool),
@@ -175,7 +175,8 @@ func (collector *TableGC) Open() (err error) {
175175

176176
// Reinitialize the pool if it was closed
177177
if collector.pool == nil {
178-
collector.pool = newPool(collector.env)
178+
// Pass empty name so that metrics are not re-registered.
179+
collector.pool = newPool(collector.env, "")
179180
}
180181

181182
collector.lifecycleStates, err = schema.ParseGCLifecycle(gcLifecycle)
@@ -714,8 +715,8 @@ func (collector *TableGC) Status() *Status {
714715
return status
715716
}
716717

717-
func newPool(env tabletenv.Env) *connpool.Pool {
718-
return connpool.NewPool(env, "TableGCPool", tabletenv.ConnPoolConfig{
718+
func newPool(env tabletenv.Env, name string) *connpool.Pool {
719+
return connpool.NewPool(env, name, tabletenv.ConnPoolConfig{
719720
Size: 2,
720721
IdleTimeout: env.Config().OltpReadPool.IdleTimeout,
721722
})

0 commit comments

Comments
 (0)