diff --git a/pilot/pkg/xds/discovery.go b/pilot/pkg/xds/discovery.go index 14678389d2a9..8aa246071909 100644 --- a/pilot/pkg/xds/discovery.go +++ b/pilot/pkg/xds/discovery.go @@ -414,9 +414,10 @@ func debounce(ch chan *model.PushRequest, stopCh <-chan struct{}, opts debounceO free := true freeCh := make(chan struct{}, 1) - push := func(req *model.PushRequest, debouncedEvents int) { + push := func(req *model.PushRequest, debouncedEvents int, startDebounce time.Time) { pushFn(req) updateSent.Add(int64(debouncedEvents)) + debounceTime.Record(time.Since(startDebounce).Seconds()) freeCh <- struct{}{} } @@ -437,7 +438,7 @@ func debounce(ch chan *model.PushRequest, stopCh <-chan struct{}, opts debounceO quietTime, eventDelay, req.Full) } free = false - go push(req, debouncedEvents) + go push(req, debouncedEvents, startDebounce) req = nil debouncedEvents = 0 } diff --git a/pilot/pkg/xds/monitoring.go b/pilot/pkg/xds/monitoring.go index da0760c24efe..624931ed6100 100644 --- a/pilot/pkg/xds/monitoring.go +++ b/pilot/pkg/xds/monitoring.go @@ -118,6 +118,12 @@ var ( ldsSendErrPushes = pushes.With(typeTag.Value("lds_senderr")) rdsSendErrPushes = pushes.With(typeTag.Value("rds_senderr")) + debounceTime = monitoring.NewDistribution( + "pilot_debounce_time", + "Delay in seconds between the first config enters debouncing and the merged push request is pushed into the push queue.", + []float64{.01, .1, 1, 3, 5, 10, 20, 30}, + ) + pushContextInitTime = monitoring.NewDistribution( "pilot_pushcontext_init_seconds", "Total time in seconds Pilot takes to init pushContext.", @@ -292,6 +298,8 @@ func init() { xdsClients, xdsResponseWriteTimeouts, pushes, + debounceTime, + pushContextInitTime, pushTime, proxiesConvergeDelay, proxiesQueueTime,