add generic http input plugin which supports setting an input data format#3546
Conversation
plugins/inputs/http/http.go
Outdated
|
|
||
| ## Mandatory data_format | ||
| ## See available options at https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md | ||
| data_format = "json" |
There was a problem hiding this comment.
This is actually optional, if unset it will default to "influx". Just use the default snippet here:
## Data format to consume.
## Each data format has its own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
# data_format = "influx"
plugins/inputs/http/http.go
Outdated
| var sampleConfig = ` | ||
| ## One or more URLs from which to read formatted metrics | ||
| urls = [ | ||
| "http://localhost:2015/simple.json" |
There was a problem hiding this comment.
Because of my comment about data_format we should set this to something more format neutral such as http://localhost/metrics
plugins/inputs/http/http.go
Outdated
| } | ||
| h.client = &http.Client{ | ||
| Transport: &http.Transport{ | ||
| ResponseHeaderTimeout: h.Timeout.Duration, |
There was a problem hiding this comment.
Don't set a response header timeout since we have the client timeout. I need to exercise these from the code so they stop getting copied around.
plugins/inputs/http/http.go
Outdated
|
|
||
| ## http request & header timeout | ||
| ## defaults to 5s if not set | ||
| timeout = "10s" |
There was a problem hiding this comment.
Update the comment based on removing header timeout (see below). Use the default value and comment it out:
# timeout = "5s"
|
I may have mentioned that I'm hoping to deprecate the The It also adds a tag A float field is added to store the |
|
I have updated based on your 4 comments. |
|
I added a few things after merging, notably method support and I decided to change the url tagging to method to automatically tag with url if it is not set in the remote host. I decided to make this change because I felt like it was closer to the way the measurement name is set. |
|
@danielnelson Thanks for merging the PR and explaining your changes. The changes make perfect sense. |
Issue #813.
Required for all PRs: