feat: error metrics
This commit is contained in:
parent
f81754b756
commit
5e75df24b1
@ -117,7 +117,7 @@ You can specify a port for the iperf3 server target. If its not set, it will use
|
||||
## Exposed metrics
|
||||
|
||||
| name | type |
|
||||
| ---------------------------------------- | ----- |
|
||||
| ---------------------------------------- | ------- |
|
||||
| iperf3_download_sent_bits_per_second | gauge |
|
||||
| iperf3_download_sent_seconds | gauge |
|
||||
| iperf3_download_sent_bytes | gauge |
|
||||
@ -132,3 +132,4 @@ You can specify a port for the iperf3 server target. If its not set, it will use
|
||||
| iperf3_upload_received_bits_per_second | gauge |
|
||||
| iperf3_upload_received_seconds | gauge |
|
||||
| iperf3_upload_received_bytes | gauge |
|
||||
| iperf3_errors | counter |
|
||||
|
3
main.go
3
main.go
@ -89,6 +89,8 @@ var (
|
||||
uploadReceivedBytes = metrics.NewFloatCounter("iperf3_upload_received_bytes")
|
||||
)
|
||||
|
||||
var scrapeErrors = metrics.NewCounter("iperf3_errors")
|
||||
|
||||
//nolint:tagliatelle
|
||||
type iperfResult struct {
|
||||
End struct {
|
||||
@ -255,6 +257,7 @@ func probeHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// Extract port and host for target.
|
||||
t, err := NewTarget(trgt)
|
||||
if err != nil {
|
||||
scrapeErrors.Inc()
|
||||
logger.Error().Err(err).Msg("could not determine target")
|
||||
http.Error(w, "could not determine target", http.StatusUnprocessableEntity)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user