Skip to content

Fix #36: keep driver_version as string when it has patch version (e.g…#39

Open
deepujain wants to merge 1 commit intoeBay:masterfrom
deepujain:issue-36
Open

Fix #36: keep driver_version as string when it has patch version (e.g…#39
deepujain wants to merge 1 commit intoeBay:masterfrom
deepujain:issue-36

Conversation

@deepujain
Copy link
Copy Markdown
Contributor

Summary of fix
Fixes #36. When driver_version from nvidia-smi has a patch segment (e.g. 460.91.03), the beat used to parse it as a float and failed with number_format_exception: multiple points. This change keeps driver_version and other string-only CSV columns as strings so patch versions are handled correctly.

Changes made

  • nvidia/gpu.go

Introduced a stringOnlyFields set for CSV columns that must never be parsed as float: driver_version, name, gpu_bus_id, gpu_uuid, process_name, gpu_name.
In the CSV parsing loop, values for these columns are stored as strings; only other columns are parsed with strconv.ParseFloat (with string fallback on error).

  • nvidia/gpu_test.go

Added Test_DriverVersion_WithPatchVersion: uses a mock that returns CSV with driver_version=460.91.03 and asserts the event stores it as a string.

No change to config or to the default query; behavior is backward compatible.

Request to eBay maintainer
Please review and merge this PR when convenient. Thank you.

…(e.g. 460.91.03)

- Add stringOnlyFields in nvidia/gpu.go for columns that must not be parsed as float
- driver_version, name, gpu_bus_id, gpu_uuid, process_name, gpu_name stored as string
- Add Test_DriverVersion_WithPatchVersion to verify driver_version 460.91.03 is string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error parsing driver_version metric when it is provided with patch version

1 participant