feat: error metrics
This commit is contained in:
parent
f81754b756
commit
5e75df24b1
33
README.md
33
README.md
@ -116,19 +116,20 @@ You can specify a port for the iperf3 server target. If its not set, it will use
|
|||||||
|
|
||||||
## Exposed metrics
|
## Exposed metrics
|
||||||
|
|
||||||
| name | type |
|
| name | type |
|
||||||
| ---------------------------------------- | ----- |
|
| ---------------------------------------- | ------- |
|
||||||
| iperf3_download_sent_bits_per_second | gauge |
|
| iperf3_download_sent_bits_per_second | gauge |
|
||||||
| iperf3_download_sent_seconds | gauge |
|
| iperf3_download_sent_seconds | gauge |
|
||||||
| iperf3_download_sent_bytes | gauge |
|
| iperf3_download_sent_bytes | gauge |
|
||||||
| iperf3_download_sent_retransmits | gauge |
|
| iperf3_download_sent_retransmits | gauge |
|
||||||
| iperf3_download_received_bits_per_second | gauge |
|
| iperf3_download_received_bits_per_second | gauge |
|
||||||
| iperf3_download_received_seconds | gauge |
|
| iperf3_download_received_seconds | gauge |
|
||||||
| iperf3_download_received_bytes | gauge |
|
| iperf3_download_received_bytes | gauge |
|
||||||
| iperf3_upload_sent_bits_per_second | gauge |
|
| iperf3_upload_sent_bits_per_second | gauge |
|
||||||
| iperf3_upload_sent_seconds | gauge |
|
| iperf3_upload_sent_seconds | gauge |
|
||||||
| iperf3_upload_sent_bytes | gauge |
|
| iperf3_upload_sent_bytes | gauge |
|
||||||
| iperf3_upload_sent_retransmits | gauge |
|
| iperf3_upload_sent_retransmits | gauge |
|
||||||
| iperf3_upload_received_bits_per_second | gauge |
|
| iperf3_upload_received_bits_per_second | gauge |
|
||||||
| iperf3_upload_received_seconds | gauge |
|
| iperf3_upload_received_seconds | gauge |
|
||||||
| iperf3_upload_received_bytes | 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")
|
uploadReceivedBytes = metrics.NewFloatCounter("iperf3_upload_received_bytes")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var scrapeErrors = metrics.NewCounter("iperf3_errors")
|
||||||
|
|
||||||
//nolint:tagliatelle
|
//nolint:tagliatelle
|
||||||
type iperfResult struct {
|
type iperfResult struct {
|
||||||
End struct {
|
End struct {
|
||||||
@ -255,6 +257,7 @@ func probeHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
// Extract port and host for target.
|
// Extract port and host for target.
|
||||||
t, err := NewTarget(trgt)
|
t, err := NewTarget(trgt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
scrapeErrors.Inc()
|
||||||
logger.Error().Err(err).Msg("could not determine target")
|
logger.Error().Err(err).Msg("could not determine target")
|
||||||
http.Error(w, "could not determine target", http.StatusUnprocessableEntity)
|
http.Error(w, "could not determine target", http.StatusUnprocessableEntity)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user