From aae1d907137e6fcb428470d75f5793319992d6a6 Mon Sep 17 00:00:00 2001 From: Stephen Soltesz Date: Wed, 24 Aug 2022 13:50:03 -0400 Subject: [PATCH] Add error string label to bbr enabled metric (#373) --- ndt7/measurer/measurer.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ndt7/measurer/measurer.go b/ndt7/measurer/measurer.go index a9c2d0f8..a3170daa 100644 --- a/ndt7/measurer/measurer.go +++ b/ndt7/measurer/measurer.go @@ -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"}, ) ) @@ -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 }