未验证 提交 d2532512 编写于 作者: V Viren Negi 提交者: GitHub

Add UserAgent header to Eureka client (#8006)

Signed-off-by: NViren Negi <meetme2meat@gmail.com>
上级 50ae4e29
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册