Skip to content

Commit

Permalink
dcgm_sampler: fix handling of DCGM string fields
Browse files Browse the repository at this point in the history
Use correct ldms function to add string metrics.
Add error messages.

Fixes #1321
  • Loading branch information
morrone authored and tom95858 committed Jan 20, 2024
1 parent a2bdf82 commit 36ddbf8
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions ldms/src/sampler/dcgm_sampler/dcgm_sampler.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,24 @@ static int gpu_schema_create()

field_meta = DcgmFieldGetById(conf.fields[i]);
ldms_type = dcgm_to_ldms_type(field_meta->fieldType);
rc = ldms_schema_metric_add(sch, field_meta->tag, ldms_type);
if (rc < 0)
if (ldms_type == LDMS_V_NONE) {
ovis_log(mylog, OVIS_LERROR,
"DCGM field %d has a DCGM type %d, which is not supported by this sampler\n",
conf.fields[i], field_meta->fieldType);
goto err2;
}
if (ldms_type == LDMS_V_CHAR_ARRAY) {
rc = ldms_schema_metric_array_add(sch, field_meta->tag,
ldms_type, field_meta->valueFormat->width+1);
} else {
rc = ldms_schema_metric_add(sch, field_meta->tag, ldms_type);
}
if (rc < 0) {
ovis_log(mylog, OVIS_LERROR,
"failed adding ldms metric to set for DCGM field %d, DCGM type %d\n",
conf.fields[i], field_meta->fieldType);
goto err2;
}
translation_table[conf.fields[i]].ldms_index = rc;
translation_table[conf.fields[i]].ldms_type = ldms_type;
}
Expand Down

0 comments on commit 36ddbf8

Please sign in to comment.