Skip to content

Commit

Permalink
Add error string label to bbr enabled metric (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-soltesz committed Aug 24, 2022
1 parent a5e9530 commit aae1d90
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ndt7/measurer/measurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var (
Name: "ndt7_measurer_bbr_enabled_total",
Help: "A counter of every attempt to enable bbr.",
},
[]string{"status"},
[]string{"status", "error"},
)
)

Expand All @@ -46,12 +46,15 @@ func (m *Measurer) getSocketAndPossiblyEnableBBR() (netx.ConnInfo, error) {
ci := netx.ToConnInfo(m.conn.UnderlyingConn())
err := ci.EnableBBR()
success := "true"
errstr := ""
if err != nil {
success = "false"
logging.Logger.WithError(err).Warn("Cannot enable BBR")
errstr = err.Error()
uuid, _ := ci.GetUUID() // to log error with uuid.
logging.Logger.WithError(err).Warn("Cannot enable BBR: " + uuid)
// FALLTHROUGH
}
BBREnabled.WithLabelValues(success).Inc()
BBREnabled.WithLabelValues(success, errstr).Inc()
return ci, nil
}

Expand Down

0 comments on commit aae1d90

Please sign in to comment.