Add UserAgent header to Eureka client (#8006)

Signed-off-by: Viren Negi <meetme2meat@gmail.com>
This commit is contained in:
Viren Negi 2020-10-03 00:39:56 +05:30 committed by GitHub
parent 50ae4e298b
commit d253251266
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -22,8 +22,11 @@ import (
"net/http"
"github.com/pkg/errors"
"github.com/prometheus/common/version"
)
var userAgent = fmt.Sprintf("Prometheus/%s", version.Version)
type Applications struct {
VersionsDelta int `xml:"versions__delta"`
AppsHashcode string `xml:"apps__hashcode"`
@ -85,6 +88,7 @@ func fetchApps(ctx context.Context, server string, client *http.Client) (*Applic
return nil, err
}
request = request.WithContext(ctx)
request.Header.Add("User-Agent", userAgent)
resp, err := client.Do(request)
if err != nil {