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

@@ -40,7 +40,6 @@ const (
defaultRequestTimeout = time.Second * 5
defaultMaxWait = 10 // seconds
defaultDatabase = "telegraf"
defaultUserAgent = "telegraf"
)
type HTTPConfig struct {
@@ -82,7 +81,7 @@ func NewHTTPClient(config *HTTPConfig) (*httpClient, error) {
userAgent := config.UserAgent
if userAgent == "" {
userAgent = defaultUserAgent
userAgent = "Telegraf/" + internal.Version()
}
var headers = make(map[string]string, len(config.Headers)+2)