From a65341730877dae29f02de32121d7e1515e395a8 Mon Sep 17 00:00:00 2001 From: ibrahimkk-moideen Date: Sun, 27 Oct 2024 11:22:17 -0400 Subject: [PATCH 1/3] remove trailing spaces in labels value --- exporter/handlers.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/exporter/handlers.go b/exporter/handlers.go index 3ebefca..6768cf9 100644 --- a/exporter/handlers.go +++ b/exporter/handlers.go @@ -166,7 +166,7 @@ func (e *Exporter) exportPowerMetrics(body []byte) error { } if watts != 9999 { - (*pow)["supplyOutput"].WithLabelValues(ps.Name, e.ChassisSerialNumber, e.Model, strings.TrimRight(ps.Manufacturer, " "), ps.SerialNumber, ps.FirmwareVersion, ps.PowerSupplyType, strconv.Itoa(bay), ps.Model).Set(watts) + (*pow)["supplyOutput"].WithLabelValues(ps.Name, e.ChassisSerialNumber, e.Model, strings.TrimRight(ps.Manufacturer, " "), strings.TrimRight(ps.SerialNumber, " "), ps.FirmwareVersion, ps.PowerSupplyType, strconv.Itoa(bay), strings.TrimRight(ps.Model, " ")).Set(watts) } if ps.Status.Health == "OK" || ps.Status.Health == "Ok" { state = OK @@ -180,7 +180,7 @@ func (e *Exporter) exportPowerMetrics(body []byte) error { } if ps.Status.State != "Absent" { - (*pow)["supplyStatus"].WithLabelValues(ps.Name, e.ChassisSerialNumber, e.Model, strings.TrimRight(ps.Manufacturer, " "), ps.SerialNumber, ps.FirmwareVersion, ps.PowerSupplyType, strconv.Itoa(bay), ps.Model).Set(state) + (*pow)["supplyStatus"].WithLabelValues(ps.Name, e.ChassisSerialNumber, e.Model, strings.TrimRight(ps.Manufacturer, " "), strings.TrimRight(ps.SerialNumber, " "), ps.FirmwareVersion, ps.PowerSupplyType, strconv.Itoa(bay), strings.TrimRight(ps.Model, " ")).Set(state) } } @@ -309,7 +309,7 @@ func (e *Exporter) exportPhysicalDriveMetrics(body []byte) error { // Physical drives need to have a unique identifier like location so as to not overwrite data // physical drives can have the same ID, but belong to a different ArrayController, therefore need more than just the ID as a unique identifier. - (*dlphysicaldrive)["driveStatus"].WithLabelValues(dlphysical.Name, e.ChassisSerialNumber, e.Model, dlphysical.Id, loc, dlphysical.SerialNumber, strconv.Itoa(cap)).Set(state) + (*dlphysicaldrive)["driveStatus"].WithLabelValues(dlphysical.Name, e.ChassisSerialNumber, e.Model, dlphysical.Id, loc, strings.TrimRight(dlphysical.SerialNumber, " "), strconv.Itoa(cap)).Set(state) return nil } @@ -347,7 +347,7 @@ func (e *Exporter) exportLogicalDriveMetrics(body []byte) error { state = DISABLED } - (*dllogicaldrive)["raidStatus"].WithLabelValues(dllogical.Name, e.ChassisSerialNumber, e.Model, ldName, volIdentifier, raidType).Set(state) + (*dllogicaldrive)["raidStatus"].WithLabelValues(strings.TrimRight(dllogical.Name, " "), e.ChassisSerialNumber, e.Model, strings.TrimRight(ldName, " "), volIdentifier, raidType).Set(state) return nil } @@ -420,7 +420,7 @@ func (e *Exporter) exportStorageControllerMetrics(body []byte) error { } else { state = BAD } - (*drv)["storageControllerStatus"].WithLabelValues(scm.Name, e.ChassisSerialNumber, e.Model, sc.FirmwareVersion, sc.Model, sc.Location.Location).Set(state) + (*drv)["storageControllerStatus"].WithLabelValues(strings.TrimRight(scm.Name, " "), e.ChassisSerialNumber, e.Model, sc.FirmwareVersion, strings.TrimRight(sc.Model, " "), sc.Location.Location).Set(state) } } @@ -431,7 +431,7 @@ func (e *Exporter) exportStorageControllerMetrics(body []byte) error { } else { state = BAD } - (*drv)["storageControllerStatus"].WithLabelValues(scm.Name, e.ChassisSerialNumber, e.Model, scm.ControllerFirmware.FirmwareVersion, scm.Model, scm.Location.Location).Set(state) + (*drv)["storageControllerStatus"].WithLabelValues(strings.TrimRight(scm.Name, " "), e.ChassisSerialNumber, e.Model, scm.ControllerFirmware.FirmwareVersion, strings.TrimRight(scm.Model, " "), scm.Location.Location).Set(state) } } @@ -642,7 +642,7 @@ func (e *Exporter) exportProcessorMetrics(body []byte) error { } else { state = BAD } - (*proc)["processorStatus"].WithLabelValues(pm.Id, e.ChassisSerialNumber, e.Model, pm.Socket, pm.Model, totCores).Set(state) + (*proc)["processorStatus"].WithLabelValues(pm.Id, e.ChassisSerialNumber, e.Model, pm.Socket, strings.TrimRight(pm.Model, " "), totCores).Set(state) return nil } @@ -659,7 +659,7 @@ func (e *Exporter) exportFirmwareInventoryMetrics(body []byte) error { // Export for iLO4 since it has a different structure if len(fwcomponent.Current.Firmware) > 0 { for _, firmware := range fwcomponent.Current.Firmware { - (*component)["componentFirmware"].WithLabelValues(firmware.Id, firmware.Name, firmware.Location, firmware.VersionString).Set(1.0) + (*component)["componentFirmware"].WithLabelValues(firmware.Id, strings.TrimRight(firmware.Name, " "), firmware.Location, firmware.VersionString).Set(1.0) } } else { // Export for iLO5, since it's structure matches the GenericFirmware struct @@ -669,7 +669,7 @@ func (e *Exporter) exportFirmwareInventoryMetrics(body []byte) error { return fmt.Errorf("Error Unmarshalling FirmwareInventoryMetrics - " + err.Error()) } - (*component)["componentFirmware"].WithLabelValues(fwcomponent.Id, fwcomponent.Name, fwcomponent.Description, fwcomponent.Version).Set(1.0) + (*component)["componentFirmware"].WithLabelValues(fwcomponent.Id, strings.TrimRight(fwcomponent.Name, " "), fwcomponent.Description, fwcomponent.Version).Set(1.0) } return nil } From a75877942285b4f6faf69250b1156d66fee2345d Mon Sep 17 00:00:00 2001 From: ibrahimkk-moideen Date: Sun, 27 Oct 2024 11:42:11 -0400 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index af7720a..5e52332 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ log is based on the [Keep a CHANGELOG](http://keepachangelog.com/) project. - Firmware metrics and request headers update for Dell iDRAC9 with FW ver.3.xx and 4.xx [#77](https://github.com/Comcast/fishymetrics/issues/77) - Power supply status duplicate bay number metrics [#85](https://github.com/Comcast/fishymetrics/issues/85) - Capturing Model field in finished scrape log message [#94](https://github.com/Comcast/fishymetrics/issues/94) +- Removed trailing spaces in label values [#96](https://github.com/Comcast/fishymetrics/issues/96) ## Updated From 0c3e1a0b361d3a037a02f4213b2343bd8f35edef Mon Sep 17 00:00:00 2001 From: ibrahimkk-moideen Date: Mon, 28 Oct 2024 12:15:10 -0400 Subject: [PATCH 3/3] updated changelog after merge with main --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e95844e..4c1b028 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ log is based on the [Keep a CHANGELOG](http://keepachangelog.com/) project. - nil pointer dereference during a scrape [#97](https://github.com/Comcast/fishymetrics/issues/97) +## Updated + + - Removed trailing spaces in label values [#96](https://github.com/Comcast/fishymetrics/issues/96) + - Add missing language fences to README [#95](https://github.com/Comcast/fishymetrics/pull/95) + ## [0.12.0] ## Added @@ -42,7 +47,6 @@ log is based on the [Keep a CHANGELOG](http://keepachangelog.com/) project. - Firmware metrics and request headers update for Dell iDRAC9 with FW ver.3.xx and 4.xx [#77](https://github.com/Comcast/fishymetrics/issues/77) - Power supply status duplicate bay number metrics [#85](https://github.com/Comcast/fishymetrics/issues/85) - Capturing Model field in finished scrape log message [#94](https://github.com/Comcast/fishymetrics/issues/94) -- Removed trailing spaces in label values [#96](https://github.com/Comcast/fishymetrics/issues/96) ## Updated