-
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
Change hddtemp to always put temperature in value field #1905
Conversation
I think it would be cleaner to bring that But that's just my opinion. I'll leave it up to the repo maintainers to decide :-) |
That's not something my issue addresses. It only addresses #1905 and the code structure is as it was. But my opinion is that single responsibility principle should apply here and keeping it as it is does enforce that and does also enhances composability. |
But your PR is making design changes that are unrelated to the issue being addressed, solely for the sake of being able to create a unit test. If we're going to make design changes, we should do it right. P.S. Recommended reading: https://blog.golang.org/organizing-go-code - "What to put into a package" section |
"right" is obviously opinionated. I remember reading that back in 2012. I'm not against moving the struct in |
I'm not against the move as long as the license is kept. When I first wrote this piece of code, go-hddtemp was an external dependency and sparrc suggested to add a license then copy its entire code to telegraf's tree. |
Also, I don't think a migration plan is needed. The sensors plugin had a major refactoring a few months ago that completely changed the schema and as long as I know - I mean "at least in Github" - there were no complaints. Considering that newer plugins have less users and the data value, I don't think we really need to be that protective to hddtemp measurements. |
@@ -53,7 +61,7 @@ func (h *HDDTemp) Gather(acc telegraf.Accumulator) error { | |||
} | |||
|
|||
fields := map[string]interface{}{ | |||
disk.DeviceName: disk.Temperature, | |||
"value": disk.Temperature, |
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.
Could this just be temperature
instead of value?
LGTM but please update the README with what the metrics look like that get collected by this plugin. I realize this is not currently there, but please add it along with this PR. |
thanks @jonaz, please update the changelog and I'll get this merged |
@sparrc is this considered feature or bugfix? never mind. must be bugfix. |
Added unit tests for the changes Fixes influxdata#1904
…data#1905) Added unit tests for the changes Fixes influxdata#1904
Added unit tests for the changes Fixes #1904
Required for all PRs:
Also added unit tests which was missing in hddtemp plugin.
this should resolve #1904
Im not sure how to handle data migration? Perhaps a config entry to handle the new format which defaults to the old?