Skip to content

Commit

Permalink
Simplified XID Error code mapping logic
Browse files Browse the repository at this point in the history
Signed-off-by: Vadym Fedorov <[email protected]>
  • Loading branch information
nvvfedorov authored and bom-d-van committed May 2, 2024
1 parent 8c36a12 commit d689096
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/dcgmexporter/gpu_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,10 @@ func ToMetric(

attrs := map[string]string{}
if counter.FieldID == dcgm.DCGM_FI_DEV_XID_ERRORS {
attrs["err_code"] = strconv.Itoa(int(val.Int64()))
if v := int(val.Int64()); 0 < v && v < len(xidErrCodeToText) && xidErrCodeToText[v] != "" {
attrs["err_msg"] = xidErrCodeToText[val.Int64()]
errCode := int(val.Int64())
attrs["err_code"] = strconv.Itoa(errCode)
if 0 < errCode && errCode < len(xidErrCodeToText) {
attrs["err_msg"] = xidErrCodeToText[errCode]
} else {
attrs["err_msg"] = "Unknown Error"
}
Expand Down

0 comments on commit d689096

Please sign in to comment.