@@ -89,12 +89,13 @@ func (PGProcessIdleCollector) Update(ctx context.Context, instance *instance, ch
89
89
90
90
var state sql.NullString
91
91
var applicationName sql.NullString
92
+ var usename sql.NullString
92
93
var secondsSum sql.NullFloat64
93
94
var secondsCount sql.NullInt64
94
95
var seconds []float64
95
96
var secondsBucket []int64
96
97
97
- err := row .Scan (& state , & applicationName , & secondsSum , & secondsCount , pq .Array (& seconds ), pq .Array (& secondsBucket ))
98
+ err := row .Scan (& state , & applicationName , & usename , & secondsSum , & secondsCount , pq .Array (& seconds ), pq .Array (& secondsBucket ))
98
99
if err != nil {
99
100
return err
100
101
}
@@ -117,6 +118,11 @@ func (PGProcessIdleCollector) Update(ctx context.Context, instance *instance, ch
117
118
applicationNameLabel = applicationName .String
118
119
}
119
120
121
+ usenameLabel := "unknown"
122
+ if usename .Valid {
123
+ usenameLabel = usename .String
124
+ }
125
+
120
126
var secondsCountMetric uint64
121
127
if secondsCount .Valid {
122
128
secondsCountMetric = uint64 (secondsCount .Int64 )
@@ -128,7 +134,7 @@ func (PGProcessIdleCollector) Update(ctx context.Context, instance *instance, ch
128
134
ch <- prometheus .MustNewConstHistogram (
129
135
pgProcessIdleSeconds ,
130
136
secondsCountMetric , secondsSumMetric , buckets ,
131
- stateLabel , applicationNameLabel ,
137
+ stateLabel , applicationNameLabel , usenameLabel ,
132
138
)
133
139
return nil
134
140
}
0 commit comments