Skip to content
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

Merged
merged 1 commit into from
Dec 13, 2016

Conversation

jonaz
Copy link
Contributor

@jonaz jonaz commented Oct 16, 2016

Required for all PRs:

  • CHANGELOG.md updated (we recommend not updating this until the PR has been approved by a maintainer)
  • Sign CLA (if not already signed)
  • README.md updated (if adding a new plugin)

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?

@phemmer
Copy link
Contributor

phemmer commented Oct 16, 2016

I think it would be cleaner to bring that go-hddtemp package into the main hddtemp plugin. Having it as a package makes the code messy. And the new changes just end up wasting memory having to deal with interfaces, empty struct pointers, persisting the object, etc. Plus it's all of 61 lines long, not worth having an entirely separate package for.

But that's just my opinion. I'll leave it up to the repo maintainers to decide :-)

@jonaz
Copy link
Contributor Author

jonaz commented Oct 16, 2016

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.

@phemmer
Copy link
Contributor

phemmer commented Oct 16, 2016

That's not something my issue addresses. It only addresses #1905 and the code structure is as it was.

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

@jonaz
Copy link
Contributor Author

jonaz commented Oct 16, 2016

"right" is obviously opinionated. I remember reading that back in 2012. I'm not against moving the struct in go-hddtemp up one level. Feel free to do that in a separate PR if you like.

@mendelgusmao
Copy link
Contributor

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.

@mendelgusmao
Copy link
Contributor

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.

@sparrc sparrc added this to the 1.2.0 milestone Nov 3, 2016
@@ -53,7 +61,7 @@ func (h *HDDTemp) Gather(acc telegraf.Accumulator) error {
}

fields := map[string]interface{}{
disk.DeviceName: disk.Temperature,
"value": disk.Temperature,
Copy link
Contributor

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?

@sparrc
Copy link
Contributor

sparrc commented Dec 13, 2016

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.

@jonaz
Copy link
Contributor Author

jonaz commented Dec 13, 2016

@goller changed to temperature
@sparrc updated readme with fields, tags and example output.

@sparrc
Copy link
Contributor

sparrc commented Dec 13, 2016

thanks @jonaz, please update the changelog and I'll get this merged

@jonaz
Copy link
Contributor Author

jonaz commented Dec 13, 2016

@sparrc is this considered feature or bugfix?

never mind. must be bugfix.

@sparrc sparrc closed this Dec 13, 2016
@sparrc sparrc reopened this Dec 13, 2016
@sparrc sparrc merged commit b4f9bc8 into influxdata:master Dec 13, 2016
njwhite pushed a commit to njwhite/telegraf that referenced this pull request Jan 31, 2017
maxunt pushed a commit that referenced this pull request Jun 26, 2018
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.

input hddtemp: Strange data? Why not just use value?
5 participants