This repository was archived by the owner on Nov 28, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +12
-7
lines changed
Expand file tree Collapse file tree 4 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,13 @@ func (g *Gauges) DeadTuples() *prometheus.GaugeVec {
2020 }, []string {"table" })
2121
2222 if ! g .hasExtension ("pgstattuple" ) {
23- log .Warn ("postgresql_dead_tuples_pct disabled because pgstattuple extension is not installed" )
23+ log .WithField ("db" , g .name ).
24+ Warn ("postgresql_dead_tuples_pct disabled because pgstattuple extension is not installed" )
2425 return gauge
2526 }
2627 if ! g .hasPermissionToExecutePgStatTuple () {
27- log .Warn ("postgresql_dead_tuples_pct disabled because user doesn't have permission to use pgstattuple functions" )
28+ log .WithField ("db" , g .name ).
29+ Warn ("postgresql_dead_tuples_pct disabled because user doesn't have permission to use pgstattuple functions" )
2830 return gauge
2931 }
3032
@@ -56,7 +58,7 @@ func (g *Gauges) DeadTuples() *prometheus.GaugeVec {
5658
5759func (g * Gauges ) hasPermissionToExecutePgStatTuple () bool {
5860 if _ , err := g .db .Exec ("SELECT 1 FROM pgstattuple('pg_class')" ); err != nil {
59- log .WithError (err ).Error ("failed to execute pgstattuple function" )
61+ log .WithField ( "db" , g . name ). WithError (err ).Error ("failed to execute pgstattuple function" )
6062 return false
6163 }
6264 return true
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ func (g *Gauges) queryWithTimeout(
152152func (g * Gauges ) version () string {
153153 var version string
154154 if err := g .db .QueryRow ("show server_version" ).Scan (& version ); err != nil {
155- log .WithError (err ).Error ("failed to get postgresql version, assuming 9.6.0" )
155+ log .WithField ( "db" , g . name ). WithError (err ).Error ("failed to get postgresql version, assuming 9.6.0" )
156156 return "9.6.0"
157157 }
158158 return version
Original file line number Diff line number Diff line change @@ -29,11 +29,13 @@ func (g *Gauges) SlowestQueries() *prometheus.GaugeVec {
2929 []string {"query" },
3030 )
3131 if ! g .hasExtension ("pg_stat_statements" ) {
32- log .Warn ("postgresql_slowest_queries disabled because pg_stat_statements extension is not installed" )
32+ log .WithField ("db" , g .name ).
33+ Warn ("postgresql_slowest_queries disabled because pg_stat_statements extension is not installed" )
3334 return gauge
3435 }
3536 if ! g .hasSharedPreloadLibrary ("pg_stat_statements" ) {
36- log .Warn ("postgresql_slowest_queries disabled because pg_stat_statements is not on shared_preload_libraries" )
37+ log .WithField ("db" , g .name ).
38+ Warn ("postgresql_slowest_queries disabled because pg_stat_statements is not on shared_preload_libraries" )
3739 return gauge
3840 }
3941 go func () {
Original file line number Diff line number Diff line change @@ -113,7 +113,8 @@ func (g *Gauges) VacuumRunningTotal() prometheus.Gauge {
113113 `
114114
115115 if ! postgres .Version (g .version ()).Is96Or10 () {
116- log .Warn ("postgresql_vacuum_running_total disabled because it's only supported for PostgreSQL 9.6 or newer versions" )
116+ log .WithField ("db" , g .name ).
117+ Warn ("postgresql_vacuum_running_total disabled because it's only supported for PostgreSQL 9.6 or newer versions" )
117118 return prometheus .NewGauge (gaugeOpts )
118119 }
119120 return g .new (gaugeOpts , vacuumRunningQuery )
You can’t perform that action at this time.
0 commit comments