Skip to content

Commit

Permalink
Enrich UserAgent with more information
Browse files Browse the repository at this point in the history
Before:
"User-Agent: v2.7.0"

After:
"User-Agent: kube-state-metrics/v2.7.0 (linux/amd64) kubernetes/1cda0bf9"

Fixes #1955
  • Loading branch information
mrueg committed Jan 23, 2023
1 parent 1cda0bf commit b64d466
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"net/http/pprof"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -334,7 +335,7 @@ func createKubeClient(apiserver string, kubeconfig string, factories ...customre
return nil, nil, nil, err
}

config.UserAgent = version.Version
config.UserAgent = fmt.Sprintf("%s/%s (%s/%s) kubernetes/%s", "kube-state-metrics", version.Version, runtime.GOOS, runtime.GOARCH, version.Revision)
config.AcceptContentTypes = "application/vnd.kubernetes.protobuf,application/json"
config.ContentType = "application/vnd.kubernetes.protobuf"

Expand Down

0 comments on commit b64d466

Please sign in to comment.