diff --git a/lib/gat/handlers/pool/pools/basic/pool.go b/lib/gat/handlers/pool/pools/basic/pool.go index d3674185a6235271c140b2b40e6d8d1afd714061..b69d7ce30caaf45666dd6c4771bd1c464de11687 100644 --- a/lib/gat/handlers/pool/pools/basic/pool.go +++ b/lib/gat/handlers/pool/pools/basic/pool.go @@ -218,7 +218,10 @@ func (T *Pool) Serve(conn *fed.Conn) error { client.Conn.Ready = true } - poolLabels := prom.PoolSimpleLabels{} + poolLabels := prom.PoolSimpleLabels{ + Database: conn.Database, + User: conn.User, + } { if T.config.ReleaseAfterTransaction { poolLabels.Mode = "transaction" diff --git a/lib/gat/handlers/pool/pools/hybrid/pool.go b/lib/gat/handlers/pool/pools/hybrid/pool.go index a32b558a6d64936222b11eff52d3118a3c855671..fb87e467c904abd89d21259db112626613f1df0f 100644 --- a/lib/gat/handlers/pool/pools/hybrid/pool.go +++ b/lib/gat/handlers/pool/pools/hybrid/pool.go @@ -450,7 +450,10 @@ func (T *Pool) serveOnly(l prom.PoolHybridLabels, conn *fed.Conn, write bool) er } func (T *Pool) Serve(conn *fed.Conn) error { - labels := prom.PoolHybridLabels{} + labels := prom.PoolHybridLabels{ + Database: conn.Database, + User: conn.User, + } switch conn.InitialParameters[strutil.MakeCIString("hybrid.mode")] { case "ro": labels.Mode = "ro" diff --git a/lib/instrumentation/prom/pool_hybrid.go b/lib/instrumentation/prom/pool_hybrid.go index f01fdd601ef59e362839b7af98a6896514a98972..28fb8a7600a24846af7217d0b384ee354b4813f8 100644 --- a/lib/instrumentation/prom/pool_hybrid.go +++ b/lib/instrumentation/prom/pool_hybrid.go @@ -11,23 +11,28 @@ func init() { } type PoolHybridLabels struct { - Mode string `label:"mode"` + Mode string `label:"mode"` + Database string `label:"database"` + User string `label:"user"` } type OperationHybridLabels struct { Pool string `label:"pool"` Mode string `label:"mode"` - Target string `label:"target"` + Target string `label:"target"` + Database string `label:"database"` + User string `label:"user"` } func (s *PoolHybridLabels) ToOperation( target string, ) OperationHybridLabels { return OperationHybridLabels{ - Pool: "hybrid", - Mode: s.Mode, - Target: target, + Pool: "hybrid", + Mode: s.Mode, + Database: s.Database, + Target: target, } } diff --git a/lib/instrumentation/prom/pool_simple.go b/lib/instrumentation/prom/pool_simple.go index 0ee132963e3e467081ced3778fcbb435322010f3..d7a1ce2a20a1a25c457bd66fc886d4d4a066d1c9 100644 --- a/lib/instrumentation/prom/pool_simple.go +++ b/lib/instrumentation/prom/pool_simple.go @@ -16,19 +16,24 @@ var PoolSimple struct { } type PoolSimpleLabels struct { - Mode string `label:"mode"` + Mode string `label:"mode"` + Database string `label:"database"` + User string `label:"user"` } func (s *PoolSimpleLabels) ToOperation() OperationSimpleLabels { return OperationSimpleLabels{ - Pool: "basic", - Mode: s.Mode, + Pool: "basic", + Mode: s.Mode, + Database: s.Database, } } type OperationSimpleLabels struct { - Pool string `label:"pool"` - Mode string `label:"mode"` + Pool string `label:"pool"` + Mode string `label:"mode"` + Database string `label:"database"` + User string `label:"user"` } var OperationSimple struct {