Merge pull request #78732 from mborsz/metric

Add 'apiserver_watch_events_total' metric.
This commit is contained in:
Kubernetes Prow Robot 2019-07-04 05:44:16 -07:00 committed by GitHub
commit 74b5603f83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -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 {

View File

@ -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(