File tree 2 files changed +19
-6
lines changed
2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,23 @@ func handleProbe(logger log.Logger) http.HandlerFunc {
78
78
registry .MustRegister (probeSuccessGauge )
79
79
registry .MustRegister (probeDurationGauge )
80
80
81
+ opts := []ExporterOpt {
82
+ DisableDefaultMetrics (* disableDefaultMetrics ),
83
+ DisableSettingsMetrics (* disableSettingsMetrics ),
84
+ AutoDiscoverDatabases (* autoDiscoverDatabases ),
85
+ WithUserQueriesPath (* queriesPath ),
86
+ WithConstantLabels (* constantLabelsList ),
87
+ ExcludeDatabases (* excludeDatabases ),
88
+ IncludeDatabases (* includeDatabases ),
89
+ }
90
+
91
+ dsns := []string {dsn }
92
+ exporter := NewExporter (dsns , opts ... )
93
+ defer func () {
94
+ exporter .servers .Close ()
95
+ }()
96
+ registry .MustRegister (exporter )
97
+
81
98
// Run the probe
82
99
pc , err := collector .NewProbeCollector (tl , registry , dsn )
83
100
if err != nil {
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ import (
17
17
"fmt"
18
18
"net/url"
19
19
"os"
20
- "strings"
21
20
"sync"
22
21
23
22
"github.com/go-kit/log"
@@ -99,7 +98,7 @@ func (ch *ConfigHandler) ReloadConfig(f string, logger log.Logger) error {
99
98
100
99
func (m AuthModule ) ConfigureTarget (target string ) (string , error ) {
101
100
// ip:port urls do not parse properly and that is the typical way users interact with postgres
102
- t := fmt .Sprintf ("exporter ://%s" , target )
101
+ t := fmt .Sprintf ("postgresql ://%s" , target )
103
102
u , err := url .Parse (t )
104
103
if err != nil {
105
104
return "" , err
@@ -115,8 +114,5 @@ func (m AuthModule) ConfigureTarget(target string) (string, error) {
115
114
}
116
115
u .RawQuery = query .Encode ()
117
116
118
- parsed := u .String ()
119
- trim := strings .TrimPrefix (parsed , "exporter://" )
120
-
121
- return trim , nil
117
+ return u .String (), nil
122
118
}
You can’t perform that action at this time.
0 commit comments