Commit db0b6de 1 parent aa83747 commit db0b6de Copy full SHA for db0b6de
File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ This plugin writes to the [Datadog Metrics API][metrics] and requires an
16
16
17
17
# # Write URL override; useful for debugging.
18
18
# url = "https://app.datadoghq.com/api/v1/series"
19
+
20
+ # # Set http_proxy (telegraf uses the system wide proxy settings if it isn't set)
21
+ # http_proxy_url = "http://localhost:8888"
19
22
```
20
23
21
24
### Metrics
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import (
12
12
13
13
"github.com/influxdata/telegraf"
14
14
"github.com/influxdata/telegraf/config"
15
+ "github.com/influxdata/telegraf/plugins/common/proxy"
15
16
"github.com/influxdata/telegraf/plugins/outputs"
16
17
)
17
18
@@ -22,6 +23,7 @@ type Datadog struct {
22
23
Log telegraf.Logger `toml:"-"`
23
24
24
25
client * http.Client
26
+ proxy.HTTPProxy
25
27
}
26
28
27
29
var sampleConfig = `
@@ -33,6 +35,9 @@ var sampleConfig = `
33
35
34
36
## Write URL override; useful for debugging.
35
37
# url = "https://app.datadoghq.com/api/v1/series"
38
+
39
+ ## Set http_proxy (telegraf uses the system wide proxy settings if it isn't set)
40
+ # http_proxy_url = "http://localhost:8888"
36
41
`
37
42
38
43
type TimeSeries struct {
@@ -55,9 +60,14 @@ func (d *Datadog) Connect() error {
55
60
return fmt .Errorf ("apikey is a required field for datadog output" )
56
61
}
57
62
63
+ proxyFunc , err := d .Proxy ()
64
+ if err != nil {
65
+ return err
66
+ }
67
+
58
68
d .client = & http.Client {
59
69
Transport : & http.Transport {
60
- Proxy : http . ProxyFromEnvironment ,
70
+ Proxy : proxyFunc ,
61
71
},
62
72
Timeout : time .Duration (d .Timeout ),
63
73
}
You can’t perform that action at this time.
0 commit comments