Merge pull request #80477 from mborsz/eventssize

Add 'apiserver_watch_events_sizes'
This commit is contained in:
Kubernetes Prow Robot 2019-08-21 17:38:32 -07:00 committed by GitHub
commit ff1e1127e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -238,6 +238,7 @@ func (s *WatchServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
// type
unknown.Raw = buf.Bytes()
event.Object = &unknown
metrics.WatchEventsSizes.WithLabelValues(kind.Group, kind.Version, kind.Kind).Observe(float64(len(unknown.Raw)))
*outEvent = metav1.WatchEvent{}

View File

@ -148,6 +148,14 @@ var (
},
[]string{"group", "version", "kind"},
)
WatchEventsSizes = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Name: "apiserver_watch_events_sizes",
Help: "Watch event size distribution in bytes",
Buckets: prometheus.ExponentialBuckets(1024, 2.0, 8), // 1K, 2K, 4K, 8K, ..., 128K.
},
[]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(
@ -171,6 +179,7 @@ var (
DeprecatedDroppedRequests,
RegisteredWatchers,
WatchEvents,
WatchEventsSizes,
currentInflightRequests,
}
)