@@ -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 {
3029return func (w http.ResponseWriter , r * http.Request ) {
3130ctx := r .Context ()
3231conf := 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-
7464tl := log .With (logger , "target" , target )
7565
76- start := time .Now ()
7766registry := prometheus .NewRegistry ()
78- registry .MustRegister (probeSuccessGauge )
79- registry .MustRegister (probeDurationGauge )
8067
8168opts := []ExporterOpt {
8269DisableDefaultMetrics (* disableDefaultMetrics ),
8370DisableSettingsMetrics (* disableSettingsMetrics ),
8471AutoDiscoverDatabases (* autoDiscoverDatabases ),
8572WithUserQueriesPath (* queriesPath ),
8673WithConstantLabels (* constantLabelsList ),
87- ExcludeDatabases (* excludeDatabases ),
74+ ExcludeDatabases (excludeDatabases ),
8875IncludeDatabases (* includeDatabases ),
8976}
9077
@@ -96,10 +83,8 @@ func handleProbe(logger log.Logger) http.HandlerFunc {
9683registry .MustRegister (exporter )
9784
9885// Run the probe
99- pc , err := collector .NewProbeCollector (tl , registry , dsn )
86+ pc , err := collector .NewProbeCollector (tl , excludeDatabases , registry , dsn )
10087if err != nil {
101- probeSuccessGauge .Set (0 )
102- probeDurationGauge .Set (time .Since (start ).Seconds ())
10388http .Error (w , err .Error (), http .StatusInternalServerError )
10489return
10590}
@@ -115,10 +100,6 @@ func handleProbe(logger log.Logger) http.HandlerFunc {
115100
116101registry .MustRegister (pc )
117102
118- duration := time .Since (start ).Seconds ()
119- probeDurationGauge .Set (duration )
120- probeSuccessGauge .Set (1 )
121-
122103// TODO check success, etc
123104h := promhttp .HandlerFor (registry , promhttp.HandlerOpts {})
124105h .ServeHTTP (w , r )
0 commit comments