Add 'apiserver_watch_events_sizes'.
That metric can be used to estimate the size of watch events sent out to the clients. Kubernetes-commit: 4af189aab9cca61d1a701133596f6f82b1ca0719
This commit is contained in:
parent
8ea3085fc3
commit
9baeaec78d
|
@ -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{}
|
||||
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue