-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to convert snmp hex strings to integers #8426
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far. One minor thing:
In the comment above the declaration of function fieldConvert()
the possible formats are described. It would be nice to either add the new option there or remove the documentation altogether...
Thanks, I've removed the comments as I think the code speaks for itself and the readme should be sufficient. |
@srebhan - Just letting you know I've build this myself for a team at our company. They have tested this in production today and it's working as intended. I hope we can have this released soon. Thanks! |
Copying my comment from over on #3716 (comment) for visibility: "hextoint" is not the correct name for the conversion. The data isn't in hex, it's in binary. "Hex" is an encoding format representing for numbers as strings using ASCII characters 0-9 A-F. That's not what this data being converted there is. The data is in raw binary, hence why there's no code to actually convert from a string in that PR. If we were to ever actually add support for converting hex, we'd have to give it a different name, and it'd be extremely confusing to have hextoint which sounds like it does hex conversion, but doesn't, and something else that does. |
Well reading the code this is exactly what is done here. The data-to-convert is a string containing a HEX representation... What is your critique concretely? In my interpretation |
I'm sorry, but you must be misreading the code. |
|
This is already released: https://docs.influxdata.com/telegraf/v1.17/about_the_project/release-notes-changelog/
That's the great thing about OSS, pull-requests can be made. Currently, it would be breaking to change it again. My suggestion is to just close the 3-year-old issue that had no priority and call it a day. With perhaps some lessons learned. |
@wiardvanrij yeah the really bad thing is that we now "never-again" can reuse the "hextoint" name as it would change the semantics of an existing option. :-( Sorry for having missed it in the first place. |
My bigger concern is that when someone comes looking for functionality to convert from binary (byte encoding) to native integer, they're not going to see this "hextoint" and realize it does what they want. While I think it would be good to fix the name, and just leave "hextoint" as an undocumented alias, at the minimum we should fix the documentation. |
Required for all PRs:
Relates to #3716