diff --git a/pkg/server/server.go b/pkg/server/server.go index 532f457ffdb7..ac881f76f108 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -905,6 +905,7 @@ func NewServer(cfg Config, stopper *stop.Stopper) (*Server, error) { s.temporaryObjectCleaner = sql.NewTemporaryObjectCleaner( s.st, s.db, + s.registry, s.distSQLServer.ServerConfig.SessionBoundInternalExecutorFactory, s.status, s.node.stores.IsMeta1Leaseholder, diff --git a/pkg/sql/temporary_schema.go b/pkg/sql/temporary_schema.go index 4645dfb20ee3..3bc5de7f0254 100644 --- a/pkg/sql/temporary_schema.go +++ b/pkg/sql/temporary_schema.go @@ -387,11 +387,14 @@ func (m *temporaryObjectCleanerMetrics) MetricStruct() {} func NewTemporaryObjectCleaner( settings *cluster.Settings, db *kv.DB, + registry *metric.Registry, makeSessionBoundInternalExecutor sqlutil.SessionBoundInternalExecutorFactory, statusServer serverpb.StatusServer, isMeta1LeaseholderFunc isMeta1LeaseholderFunc, testingKnobs ExecutorTestingKnobs, ) *TemporaryObjectCleaner { + metrics := makeTemporaryObjectCleanerMetrics() + registry.AddMetricStruct(metrics) return &TemporaryObjectCleaner{ settings: settings, db: db, @@ -399,7 +402,7 @@ func NewTemporaryObjectCleaner( statusServer: statusServer, isMeta1LeaseholderFunc: isMeta1LeaseholderFunc, testingKnobs: testingKnobs, - metrics: makeTemporaryObjectCleanerMetrics(), + metrics: metrics, } }