Skip to content

Commit 2525ab8

Browse files
authored
Merge pull request kubernetes#77759 from haiyanmeng/host
Remove the `host` label from the kubelet http traffic metrics
2 parents 389252f + 4751f40 commit 2525ab8

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

pkg/kubelet/server/metrics/metrics.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var (
3838
// server_type aims to differentiate the readonly server and the readwrite server.
3939
// long_running marks whether the request is long-running or not.
4040
// Currently, long-running requests include exec/attach/portforward/debug.
41-
[]string{"method", "path", "host", "server_type", "long_running"},
41+
[]string{"method", "path", "server_type", "long_running"},
4242
)
4343
// HTTPRequestsDuration tracks the duration in seconds to serve http requests.
4444
HTTPRequestsDuration = prometheus.NewHistogramVec(
@@ -49,7 +49,7 @@ var (
4949
// Use DefBuckets for now, will customize the buckets if necessary.
5050
Buckets: prometheus.DefBuckets,
5151
},
52-
[]string{"method", "path", "host", "server_type", "long_running"},
52+
[]string{"method", "path", "server_type", "long_running"},
5353
)
5454
// HTTPInflightRequests tracks the number of the inflight http requests.
5555
HTTPInflightRequests = prometheus.NewGaugeVec(
@@ -58,7 +58,7 @@ var (
5858
Name: "http_inflight_requests",
5959
Help: "Number of the inflight http requests",
6060
},
61-
[]string{"method", "path", "host", "server_type", "long_running"},
61+
[]string{"method", "path", "server_type", "long_running"},
6262
)
6363
)
6464

pkg/kubelet/server/server.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -859,17 +859,17 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
859859
serverType = "readwrite"
860860
}
861861

862-
method, path, host := req.Method, trimURLPath(req.URL.Path), req.URL.Host
862+
method, path := req.Method, trimURLPath(req.URL.Path)
863863

864864
longRunning := strconv.FormatBool(isLongRunningRequest(path))
865865

866-
servermetrics.HTTPRequests.WithLabelValues(method, path, host, serverType, longRunning).Inc()
866+
servermetrics.HTTPRequests.WithLabelValues(method, path, serverType, longRunning).Inc()
867867

868-
servermetrics.HTTPInflightRequests.WithLabelValues(method, path, host, serverType, longRunning).Inc()
869-
defer servermetrics.HTTPInflightRequests.WithLabelValues(method, path, host, serverType, longRunning).Dec()
868+
servermetrics.HTTPInflightRequests.WithLabelValues(method, path, serverType, longRunning).Inc()
869+
defer servermetrics.HTTPInflightRequests.WithLabelValues(method, path, serverType, longRunning).Dec()
870870

871871
startTime := time.Now()
872-
defer servermetrics.HTTPRequestsDuration.WithLabelValues(method, path, host, serverType, longRunning).Observe(servermetrics.SinceInSeconds(startTime))
872+
defer servermetrics.HTTPRequestsDuration.WithLabelValues(method, path, serverType, longRunning).Observe(servermetrics.SinceInSeconds(startTime))
873873

874874
s.restfulCont.ServeHTTP(w, req)
875875
}

0 commit comments

Comments
 (0)