-
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 generic http input plugin which supports setting an input data format #3546
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: