File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,9 @@ func handleProbe(logger log.Logger) http.HandlerFunc {
104104 return
105105 }
106106
107+ // Cleanup underlying connections to prevent connection leaks
108+ defer pc .Close ()
109+
107110 // TODO(@sysadmind): Remove the registry.MustRegister() call below and instead handle the collection here. That will allow
108111 // for the passing of context, handling of timeouts, and more control over the collection.
109112 // The current NewProbeCollector() implementation relies on the MustNewConstMetric() call to create the metrics which is not
Original file line number Diff line number Diff line change @@ -83,3 +83,7 @@ func (pc *ProbeCollector) Collect(ch chan<- prometheus.Metric) {
8383 }
8484 wg .Wait ()
8585}
86+
87+ func (pc * ProbeCollector ) Close () error {
88+ return pc .db .Close ()
89+ }
You can’t perform that action at this time.
0 commit comments