parent
18fff4a3f5
commit
035e4cf90a
|
@ -1,3 +1,11 @@
|
||||||
|
## v0.11.1 [unreleased]
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
### Bugfixes
|
||||||
|
- [#852](https://github.com/influxdata/telegraf/issues/852): Windows zip package fix
|
||||||
|
- [#859](https://github.com/influxdata/telegraf/issues/859): httpjson plugin panic
|
||||||
|
|
||||||
## v0.11.0 [2016-03-15]
|
## v0.11.0 [2016-03-15]
|
||||||
|
|
||||||
### Release Notes
|
### Release Notes
|
||||||
|
|
|
@ -55,15 +55,15 @@ type RealHTTPClient struct {
|
||||||
client *http.Client
|
client *http.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c RealHTTPClient) MakeRequest(req *http.Request) (*http.Response, error) {
|
func (c *RealHTTPClient) MakeRequest(req *http.Request) (*http.Response, error) {
|
||||||
return c.client.Do(req)
|
return c.client.Do(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c RealHTTPClient) SetHTTPClient(client *http.Client) {
|
func (c *RealHTTPClient) SetHTTPClient(client *http.Client) {
|
||||||
c.client = client
|
c.client = client
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c RealHTTPClient) HTTPClient() *http.Client {
|
func (c *RealHTTPClient) HTTPClient() *http.Client {
|
||||||
return c.client
|
return c.client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,6 +289,8 @@ func (h *HttpJson) sendRequest(serverURL string) (string, float64, error) {
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
inputs.Add("httpjson", func() telegraf.Input {
|
inputs.Add("httpjson", func() telegraf.Input {
|
||||||
return &HttpJson{client: RealHTTPClient{}}
|
return &HttpJson{
|
||||||
|
client: &RealHTTPClient{},
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ type mockHTTPClient struct {
|
||||||
// Mock implementation of MakeRequest. Usually returns an http.Response with
|
// Mock implementation of MakeRequest. Usually returns an http.Response with
|
||||||
// hard-coded responseBody and statusCode. However, if the request uses a
|
// hard-coded responseBody and statusCode. However, if the request uses a
|
||||||
// nonstandard method, it uses status code 405 (method not allowed)
|
// nonstandard method, it uses status code 405 (method not allowed)
|
||||||
func (c mockHTTPClient) MakeRequest(req *http.Request) (*http.Response, error) {
|
func (c *mockHTTPClient) MakeRequest(req *http.Request) (*http.Response, error) {
|
||||||
resp := http.Response{}
|
resp := http.Response{}
|
||||||
resp.StatusCode = c.statusCode
|
resp.StatusCode = c.statusCode
|
||||||
|
|
||||||
|
@ -147,10 +147,10 @@ func (c mockHTTPClient) MakeRequest(req *http.Request) (*http.Response, error) {
|
||||||
return &resp, nil
|
return &resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c mockHTTPClient) SetHTTPClient(_ *http.Client) {
|
func (c *mockHTTPClient) SetHTTPClient(_ *http.Client) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c mockHTTPClient) HTTPClient() *http.Client {
|
func (c *mockHTTPClient) HTTPClient() *http.Client {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ func (c mockHTTPClient) HTTPClient() *http.Client {
|
||||||
func genMockHttpJson(response string, statusCode int) []*HttpJson {
|
func genMockHttpJson(response string, statusCode int) []*HttpJson {
|
||||||
return []*HttpJson{
|
return []*HttpJson{
|
||||||
&HttpJson{
|
&HttpJson{
|
||||||
client: mockHTTPClient{responseBody: response, statusCode: statusCode},
|
client: &mockHTTPClient{responseBody: response, statusCode: statusCode},
|
||||||
Servers: []string{
|
Servers: []string{
|
||||||
"http://server1.example.com/metrics/",
|
"http://server1.example.com/metrics/",
|
||||||
"http://server2.example.com/metrics/",
|
"http://server2.example.com/metrics/",
|
||||||
|
@ -181,7 +181,7 @@ func genMockHttpJson(response string, statusCode int) []*HttpJson {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&HttpJson{
|
&HttpJson{
|
||||||
client: mockHTTPClient{responseBody: response, statusCode: statusCode},
|
client: &mockHTTPClient{responseBody: response, statusCode: statusCode},
|
||||||
Servers: []string{
|
Servers: []string{
|
||||||
"http://server3.example.com/metrics/",
|
"http://server3.example.com/metrics/",
|
||||||
"http://server4.example.com/metrics/",
|
"http://server4.example.com/metrics/",
|
||||||
|
@ -241,7 +241,7 @@ func TestHttpJsonGET_URL(t *testing.T) {
|
||||||
Servers: []string{ts.URL + "?api_key=mykey"},
|
Servers: []string{ts.URL + "?api_key=mykey"},
|
||||||
Name: "",
|
Name: "",
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
client: RealHTTPClient{client: &http.Client{}},
|
client: &RealHTTPClient{client: &http.Client{}},
|
||||||
}
|
}
|
||||||
|
|
||||||
var acc testutil.Accumulator
|
var acc testutil.Accumulator
|
||||||
|
@ -314,7 +314,7 @@ func TestHttpJsonGET(t *testing.T) {
|
||||||
Name: "",
|
Name: "",
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Parameters: params,
|
Parameters: params,
|
||||||
client: RealHTTPClient{client: &http.Client{}},
|
client: &RealHTTPClient{client: &http.Client{}},
|
||||||
}
|
}
|
||||||
|
|
||||||
var acc testutil.Accumulator
|
var acc testutil.Accumulator
|
||||||
|
@ -388,7 +388,7 @@ func TestHttpJsonPOST(t *testing.T) {
|
||||||
Name: "",
|
Name: "",
|
||||||
Method: "POST",
|
Method: "POST",
|
||||||
Parameters: params,
|
Parameters: params,
|
||||||
client: RealHTTPClient{client: &http.Client{}},
|
client: &RealHTTPClient{client: &http.Client{}},
|
||||||
}
|
}
|
||||||
|
|
||||||
var acc testutil.Accumulator
|
var acc testutil.Accumulator
|
||||||
|
|
Loading…
Reference in New Issue