File tree 2 files changed +7
-0
lines changed
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 {
104
104
return
105
105
}
106
106
107
+ // Cleanup underlying connections to prevent connection leaks
108
+ defer pc .Close ()
109
+
107
110
// TODO(@sysadmind): Remove the registry.MustRegister() call below and instead handle the collection here. That will allow
108
111
// for the passing of context, handling of timeouts, and more control over the collection.
109
112
// 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) {
83
83
}
84
84
wg .Wait ()
85
85
}
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