fix(go.d/proxysql): use timeout when pinging proxysql instance (#21573)
Ilya Mashchenko committed
Jan 16, 2026 at 09:24 UTC
30a1331f6a723450047a5fa11eb1726679fb1e3b
1 file changed
+4
-1
src/go/plugin/go.d/collector/proxysql/collect.go
+4
-1
@@ -251,7 +251,10 @@ func (c *Collector) openConnection() error {
251
252
db.SetConnMaxLifetime(10 * time.Minute)
253
254
- if err := db.Ping(); err != nil {
254
+ ctx, cancel := context.WithTimeout(context.Background(), c.Timeout.Duration())
255
+ defer cancel()
256
+
257
+ if err := db.PingContext(ctx); err != nil {
258
_ = db.Close()
259
return fmt.Errorf("error on pinging the proxysql instance [%s]: %v", c.DSN, err)
260
}