Add telegraf version to User-Agent header (#4838)

Header is added in influxdb, influxdb_v2, and http outputs.
This commit is contained in:
Kevin Conaway
2018-10-11 15:25:21 -04:00
committed by Daniel Nelson
parent 502d9ab499
commit 44fd74d688
5 changed files with 50 additions and 7 deletions

View File

@@ -187,6 +187,7 @@ func (h *HTTP) write(reqBody []byte) error {
req.SetBasicAuth(h.Username, h.Password)
}
req.Header.Set("User-Agent", "Telegraf/"+internal.Version())
req.Header.Set("Content-Type", defaultContentType)
if h.ContentEncoding == "gzip" {
req.Header.Set("Content-Encoding", "gzip")