diff --git a/private/dbutil/cockroachutil/db.go b/private/dbutil/cockroachutil/db.go index b44d6098f..0f496179a 100644 --- a/private/dbutil/cockroachutil/db.go +++ b/private/dbutil/cockroachutil/db.go @@ -70,7 +70,7 @@ func OpenUnique(ctx context.Context, connStr string, schemaPrefix string) (db *d return nil, errs.Combine(errs.Wrap(err), cleanup(masterDB)) } - dbutil.Configure(sqlDB, mon) + dbutil.Configure(sqlDB, "tmp_cockroach", mon) return &dbutil.TempDatabase{ DB: sqlDB, ConnStr: modifiedConnStr, diff --git a/private/dbutil/defaults.go b/private/dbutil/defaults.go index f6913c72c..765febf68 100644 --- a/private/dbutil/defaults.go +++ b/private/dbutil/defaults.go @@ -26,7 +26,7 @@ type ConfigurableDB interface { } // Configure Sets Connection Boundaries and adds db_stats monitoring to monkit -func Configure(db ConfigurableDB, mon *monkit.Scope) { +func Configure(db ConfigurableDB, dbName string, mon *monkit.Scope) { if *maxIdleConns >= 0 { db.SetMaxIdleConns(*maxIdleConns) } @@ -38,6 +38,6 @@ func Configure(db ConfigurableDB, mon *monkit.Scope) { } mon.Chain(monkit.StatSourceFunc( func(cb func(key monkit.SeriesKey, field string, val float64)) { - monkit.StatSourceFromStruct(monkit.NewSeriesKey("db_stats"), db.Stats()).Stats(cb) + monkit.StatSourceFromStruct(monkit.NewSeriesKey("db_stats").WithTag("db_name", dbName), db.Stats()).Stats(cb) })) } diff --git a/private/dbutil/pgutil/db.go b/private/dbutil/pgutil/db.go index 98bf2380f..0589871f0 100644 --- a/private/dbutil/pgutil/db.go +++ b/private/dbutil/pgutil/db.go @@ -51,7 +51,7 @@ func OpenUnique(ctx context.Context, connstr string, schemaPrefix string) (*dbut return DropSchema(ctx, cleanupDB, schemaName) } - dbutil.Configure(db, mon) + dbutil.Configure(db, "tmp_postgres", mon) return &dbutil.TempDatabase{ DB: db, ConnStr: connStrWithSchema, diff --git a/satellite/satellitedb/database.go b/satellite/satellitedb/database.go index fc67c7e6d..801c08bbd 100644 --- a/satellite/satellitedb/database.go +++ b/satellite/satellitedb/database.go @@ -79,7 +79,7 @@ func New(log *zap.Logger, databaseURL string, opts Options) (satellite.DB, error } log.Debug("Connected to:", zap.String("db source", source)) - dbutil.Configure(dbxDB.DB, mon) + dbutil.Configure(dbxDB.DB, "satellitedb", mon) core := &satelliteDB{ DB: dbxDB, diff --git a/storage/cockroachkv/client.go b/storage/cockroachkv/client.go index fc0d0541f..b64df27d9 100644 --- a/storage/cockroachkv/client.go +++ b/storage/cockroachkv/client.go @@ -40,7 +40,7 @@ func New(dbURL string) (*Client, error) { return nil, err } - dbutil.Configure(db, mon) + dbutil.Configure(db, "cockroachkv", mon) // TODO: new shouldn't be taking ctx as argument err = schema.PrepareDB(context.TODO(), db) diff --git a/storage/postgreskv/client.go b/storage/postgreskv/client.go index c772dc2f5..f3547a2fb 100644 --- a/storage/postgreskv/client.go +++ b/storage/postgreskv/client.go @@ -38,7 +38,7 @@ func New(dbURL string) (*Client, error) { return nil, err } - dbutil.Configure(db, mon) + dbutil.Configure(db, "postgreskv", mon) //TODO: Fix the parameters!! err = schema.PrepareDB(context.TODO(), db, dbURL) if err != nil { diff --git a/storagenode/storagenodedb/database.go b/storagenode/storagenodedb/database.go index f33e74dba..ecc122447 100644 --- a/storagenode/storagenodedb/database.go +++ b/storagenode/storagenodedb/database.go @@ -265,7 +265,7 @@ func (db *DB) openDatabase(dbName string) error { mDB := db.SQLDBs[dbName] mDB.Configure(sqlDB) - dbutil.Configure(sqlDB, mon) + dbutil.Configure(sqlDB, dbName, mon) return nil }