Kong / mesh-perf

Performance tests of Kong Mesh
Apache License 2.0
0 stars 1 forks source link

fix(test): change assertion to use 'xds_requests_received' instead of 'xds_delivery_count' #96

Closed lobkovilya closed 1 year ago

lobkovilya commented 1 year ago

Metric xds_delivery_count can show fewer xds deliveries than actually happened because of this cleanup:

https://github.com/kumahq/kuma/blob/3a9aecf0d710dc36463ff650737b55829314e073/pkg/util/xds/stats_callbacks.go#L43-L51

func (s *statsCallbacks) ConfigReadyForDelivery(configVersion string) {
    s.Lock()
    if len(s.configsQueue) > ConfigInFlightThreshold {
        // We clean up times of ready for delivery configs when config is delivered or client is disconnected.
        // However, there is always a potential case that may have missed.
        // When we get to the point of ConfigInFlightThreshold elements in the map we want to wipe the map
        // instead of grow it to the point that CP runs out of memory.
        // The statistic is not critical for CP to work, and we will still get data points of configs that are constantly being delivered.
        statsLogger.Info("cleaning up config ready for delivery times to avoid potential memory leak. This operation may cause problems with metric for a short period of time", "metric", s.deliveryMetricName)
        s.configsQueue = map[string]time.Time{}
    }
    s.configsQueue[configVersion] = core.Now()
    s.Unlock()
}

Current PR replaces assertion to use xds_requests_received instead