-
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 lang parameter to OpenWeathermap input plugin #6504
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0240845
Add lang parameter to OpenWeathermap input plugin
reimda 8981424
Add new conditions tags and fields for forecast API
reimda 39836f6
Update README.md for new conditions fields and tags
reimda b510d4d
Made changes requested in glinton's review
reimda 3ccb586
changed requested in reviews
reimda d6d05b5
Make changes requested in review
reimda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
Swap
condition_id
withcondition_description
, making it a tag, and this a field. Also, is the_description
more valuable than the_main
? It seems like they are essentially duplicate data.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.
I could be wrong but I think it makes more sense to have ID as a tag and description as a field. Description is the same information as ID, but human readable and localized. I would rather select ID=802 than description="scattered clouds: 25-50%" or possibly a localization like "Mäßig bewölkt". Using ID to select means you don't have to know which language was enabled in the telegraf conf when the data was collected.
Description/ID is more valuable than main. You could map ID to main's value and leave out main completely. I included it for the same reasons as icon- It's part of OWM's API and someone familiar with it would think it's missing if we don't include it.
I made main a tag because it's a single word and it isn't localized. It might make sense to make it a field instead.
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.
It's quite common for telegraf to not create a metric from everything provided by an api. Some things just don't make sense as time series data.
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.
Regarding the human readable vs id: telegraf has standardized enum "codes" to be stored as fields and the string representations to be stored as tags. One example is the
kube_inventory
plugin (state
andstate_code
):telegraf/plugins/inputs/kube_inventory/pod.go
Lines 55 to 63 in 817c9a6
Very much agree. I'm not sure where/why you would do the other option. Both are still possible in either configuration from what I understand, but in influx, you can only
group by
tags.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.
The influxdb schema design docs have some advice on choosing tags vs fields (https://docs.influxdata.com/influxdb/v1.7/concepts/schema_and_data_layout/). It says to make it a tag if it's commonly queried or used in a group by. Only tags are indexed, so querying on fields is slow.
After reading those docs I think I'd like to leave id and main as tags and description as a field. I imagine querying on and grouping by conditions will be common, so main and id should be tags. If you want the general condition like snowy days, use main="snow". If you want a specific condition like all days with freezing rain, use id="511". I think description isn't going to be commonly queried because it's localized and too long, so it should be a field.
I think the difference between this and kube_inventory is that kube_inventory's state is short (one word), only has three values, and isn't localized. That makes state easier to use than state_code, so it fits the tags criteria better.
I'd be fine leaving out icon but I don't think it's hurting anything. It doesn't give you much over id and main for grouping or querying, so if it stays it should be a field. It's only really useful if you build custom ui and need a weather conditions icon. I'm leaning towards leaving it in and letting people filter it out if they don't want it.