Skip to content

Commit

Permalink
Merge pull request #80477 from mborsz/eventssize
Browse files Browse the repository at this point in the history
Add 'apiserver_watch_events_sizes'
  • Loading branch information
k8s-ci-robot committed Aug 22, 2019
2 parents 1a53325 + 4af189a commit ff1e112
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Expand Up @@ -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{}

Expand Down
9 changes: 9 additions & 0 deletions staging/src/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go
Expand Up @@ -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(
Expand All @@ -171,6 +179,7 @@ var (
DeprecatedDroppedRequests,
RegisteredWatchers,
WatchEvents,
WatchEventsSizes,
currentInflightRequests,
}
)
Expand Down

0 comments on commit ff1e112

Please sign in to comment.