@@ -16,7 +16,6 @@ package main
1616import (
1717 "fmt"
1818 "net/http"
19- "time"
2019
2120 "github.com/go-kit/log"
2221 "github.com/go-kit/log/level"
@@ -26,7 +25,7 @@ import (
2625 "github.com/prometheus/client_golang/prometheus/promhttp"
2726)
2827
29- func handleProbe (logger log.Logger ) http.HandlerFunc {
28+ func handleProbe (logger log.Logger , excludeDatabases [] string ) http.HandlerFunc {
3029 return func (w http.ResponseWriter , r * http.Request ) {
3130 ctx := r .Context ()
3231 conf := c .GetConfig ()
@@ -62,29 +61,17 @@ func handleProbe(logger log.Logger) http.HandlerFunc {
6261
6362 // TODO(@sysadmind): Timeout
6463
65- probeSuccessGauge := prometheus .NewGauge (prometheus.GaugeOpts {
66- Name : "probe_success" ,
67- Help : "Displays whether or not the probe was a success" ,
68- })
69- probeDurationGauge := prometheus .NewGauge (prometheus.GaugeOpts {
70- Name : "probe_duration_seconds" ,
71- Help : "Returns how long the probe took to complete in seconds" ,
72- })
73-
7464 tl := log .With (logger , "target" , target )
7565
76- start := time .Now ()
7766 registry := prometheus .NewRegistry ()
78- registry .MustRegister (probeSuccessGauge )
79- registry .MustRegister (probeDurationGauge )
8067
8168 opts := []ExporterOpt {
8269 DisableDefaultMetrics (* disableDefaultMetrics ),
8370 DisableSettingsMetrics (* disableSettingsMetrics ),
8471 AutoDiscoverDatabases (* autoDiscoverDatabases ),
8572 WithUserQueriesPath (* queriesPath ),
8673 WithConstantLabels (* constantLabelsList ),
87- ExcludeDatabases (* excludeDatabases ),
74+ ExcludeDatabases (excludeDatabases ),
8875 IncludeDatabases (* includeDatabases ),
8976 }
9077
@@ -96,10 +83,8 @@ func handleProbe(logger log.Logger) http.HandlerFunc {
9683 registry .MustRegister (exporter )
9784
9885 // Run the probe
99- pc , err := collector .NewProbeCollector (tl , registry , dsn )
86+ pc , err := collector .NewProbeCollector (tl , excludeDatabases , registry , dsn )
10087 if err != nil {
101- probeSuccessGauge .Set (0 )
102- probeDurationGauge .Set (time .Since (start ).Seconds ())
10388 http .Error (w , err .Error (), http .StatusInternalServerError )
10489 return
10590 }
@@ -115,10 +100,6 @@ func handleProbe(logger log.Logger) http.HandlerFunc {
115100
116101 registry .MustRegister (pc )
117102
118- duration := time .Since (start ).Seconds ()
119- probeDurationGauge .Set (duration )
120- probeSuccessGauge .Set (1 )
121-
122103 // TODO check success, etc
123104 h := promhttp .HandlerFor (registry , promhttp.HandlerOpts {})
124105 h .ServeHTTP (w , r )
0 commit comments