MCPcopy Create free account
hub / github.com/github/gh-aw / getSortedServerNames

Function getSortedServerNames

pkg/cli/gateway_logs_render.go:189–201  ·  view source on GitHub ↗

getSortedServerNames returns server names sorted by request count

(metrics *GatewayMetrics)

Source from the content-addressed store, hash-verified

187
188// getSortedServerNames returns server names sorted by request count
189func getSortedServerNames(metrics *GatewayMetrics) []string {
190 names := sliceutil.MapKeys(metrics.Servers)
191 slices.SortFunc(names, func(a, b string) int {
192 if metrics.Servers[a].RequestCount > metrics.Servers[b].RequestCount {
193 return -1
194 }
195 if metrics.Servers[a].RequestCount < metrics.Servers[b].RequestCount {
196 return 1
197 }
198 return 0
199 })
200 return names
201}
202
203// displayAggregatedGatewayMetrics aggregates and displays gateway metrics across all processed runs
204func displayAggregatedGatewayMetrics(processedRuns []ProcessedRun, outputDir string, verbose bool) {

Callers 2

TestGetSortedServerNamesFunction · 0.85

Calls 1

MapKeysFunction · 0.92

Tested by 1

TestGetSortedServerNamesFunction · 0.68