Fix #36: keep driver_version as string when it has patch version (e.g…#39
Open
deepujain wants to merge 1 commit intoeBay:masterfrom
Open
Fix #36: keep driver_version as string when it has patch version (e.g…#39deepujain wants to merge 1 commit intoeBay:masterfrom
deepujain wants to merge 1 commit intoeBay:masterfrom
Conversation
…(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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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).
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.