func newStatistics(app types.App, cacheZones map[string]*types.CacheZone) statisticsRoot { var zones = make([]zoneStatistics, 0, len(cacheZones)) for _, cacheZone := range cacheZones { var stats = cacheZone.Algorithm.Stats() zones = append(zones, zoneStatistics{ ID: stats.ID(), Hits: stats.Hits(), Requests: stats.Requests(), Objects: stats.Objects(), CacheHitPrc: stats.CacheHitPrc(), Size: stats.Size().Bytes(), }) } var appStats = app.Stats() return statisticsRoot{ Requests: appStats.Requests, Responded: appStats.Responded, NotConfigured: appStats.NotConfigured, InFlight: appStats.Requests - appStats.Responded - appStats.NotConfigured, CacheZones: zones, Started: app.Started(), Version: versionFromAppVersion(app.Version()), } }