mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Add 'apiserver_watch_events_total' metric.
We found this metric useful to understand the CPU usage of the kube-apiserver process.
This commit is contained in:
parent
88f8c785b4
commit
58d3338ddd
@ -225,6 +225,7 @@ func (s *WatchServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
// End of results.
|
||||
return
|
||||
}
|
||||
metrics.WatchEvents.WithLabelValues(kind.Group, kind.Version, kind.Kind).Inc()
|
||||
|
||||
obj := s.Fixup(event.Object)
|
||||
if err := s.EmbeddedEncoder.Encode(obj, buf); err != nil {
|
||||
|
@ -141,6 +141,13 @@ var (
|
||||
},
|
||||
[]string{"group", "version", "kind"},
|
||||
)
|
||||
WatchEvents = prometheus.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Name: "apiserver_watch_events_total",
|
||||
Help: "Number of events sent in watch clients",
|
||||
},
|
||||
[]string{"group", "version", "kind"},
|
||||
)
|
||||
// Because of volatality of the base metric this is pre-aggregated one. Instead of reporing current usage all the time
|
||||
// it reports maximal usage during the last second.
|
||||
currentInflightRequests = prometheus.NewGaugeVec(
|
||||
|
Loading…
Reference in New Issue
Block a user