Fix #32: keep driver_version as string (e.g. 460.32.03) to avoid ES f…#41
Open
deepujain wants to merge 1 commit intoeBay:masterfrom
Open
Fix #32: keep driver_version as string (e.g. 460.32.03) to avoid ES f…#41deepujain wants to merge 1 commit intoeBay:masterfrom
deepujain wants to merge 1 commit intoeBay:masterfrom
Conversation
…ES float parse error - 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_WithTwoDots to verify driver_version 460.32.03 is string Co-authored-by: Cursor <cursoragent@cursor.com>
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 #32. With driver versions like 460.32.03 (two dots), the beat could send driver_version in a way that led Elasticsearch to map it as float. Indexing then failed with mapper_parsing_exception: failed to parse field [driver_version] of type [float] and number_format_exception: multiple points. This change keeps driver_version and other string-only CSV columns as strings so ES no longer tries to parse them as float.
Changes made
nvidia/gpu.go
Added 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_WithTwoDots: uses a mock that returns CSV with driver_version=460.32.03 and asserts the event stores it as a string.
No config or default query changes; behavior is backward compatible.
Request to eBay maintainer
Please review and merge this PR when convenient. Thank you.