Skip to content

Commit

Permalink
Merge pull request #115 from SuperQ/superq/read_timeout
Browse files Browse the repository at this point in the history
Ignore network read timeout errors
  • Loading branch information
SuperQ authored Jul 12, 2023
2 parents 04602a7 + 9582c1a commit c0848dc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* [ENHANCEMENT]
* [BUGFIX]

## 0.7.1 / 2023-06-12

* [BUGFIX] Ignore network read timeout errors #115

## 0.7.0 / 2023-07-10

* [FEATURE] Make source ip configurable #83
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.0
0.7.1
8 changes: 8 additions & 0 deletions collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package main

import (
"net"

"github.com/prometheus-community/pro-bing"

"github.com/go-kit/log/level"
Expand Down Expand Up @@ -110,6 +112,12 @@ func NewSmokepingCollector(pingers *[]*probing.Pinger, pingResponseSeconds prome
stats.AvgRtt, "max_rtt", stats.MaxRtt, "stddev_rtt", stats.StdDevRtt)
}
pinger.OnRecvError = func(err error) {
if neterr, ok := err.(*net.OpError); ok {
if neterr.Timeout() {
// Ignore read timeout errors, these are handled by the pinger.
return
}
}
pingRecvErrors.Inc()
level.Debug(logger).Log("msg", "Error receiving packet", "error", err)
}
Expand Down

0 comments on commit c0848dc

Please sign in to comment.