mirror of
https://github.com/prometheus/prometheus.git
synced 2025-07-03 11:03:25 +00:00
Update http header User-Agent
in k8s and swarm discovery. (#7614)
* discovery: update k8s and swarm user agent. Signed-off-by: johncming <johncming@yahoo.com>
This commit is contained in:
parent
f482c7bdd7
commit
3c5ff27959
2 changed files with 11 additions and 1 deletions
|
@ -15,6 +15,7 @@ package kubernetes
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
|
@ -36,6 +37,7 @@ import (
|
|||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
|
||||
"github.com/prometheus/common/version"
|
||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||
)
|
||||
|
||||
|
@ -49,6 +51,8 @@ const (
|
|||
)
|
||||
|
||||
var (
|
||||
// Http header
|
||||
userAgent = fmt.Sprintf("Prometheus/%s", version.Version)
|
||||
// Custom events metric
|
||||
eventCount = prometheus.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
|
@ -262,7 +266,7 @@ func New(l log.Logger, conf *SDConfig) (*Discovery, error) {
|
|||
}
|
||||
}
|
||||
|
||||
kcfg.UserAgent = "Prometheus/discovery"
|
||||
kcfg.UserAgent = userAgent
|
||||
|
||||
c, err := kubernetes.NewForConfig(kcfg)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue