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

@@ -27,10 +27,8 @@ const (
)
const (
defaultRequestTimeout = time.Second * 5
defaultDatabase = "telegraf"
defaultUserAgent = "telegraf"
defaultRequestTimeout = time.Second * 5
defaultDatabase = "telegraf"
errStringDatabaseNotFound = "database not found"
errStringHintedHandoffNotEmpty = "hinted handoff queue not empty"
errStringPartialWrite = "partial write"
@@ -138,7 +136,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)+1)