@@ -346,7 +346,10 @@ func (mc *MetricsCollector) GetMetrics() map[string]interface{} {
346
346
347
347
// Sort by increasing average response time (faster servers first)
348
348
sort .Slice (serverPerfs , func (i , j int ) bool {
349
- return serverPerfs [i ].avgTime < serverPerfs [j ].avgTime
349
+ if serverPerfs [i ].avgTime != serverPerfs [j ].avgTime {
350
+ return serverPerfs [i ].avgTime < serverPerfs [j ].avgTime
351
+ }
352
+ return serverPerfs [i ].name < serverPerfs [j ].name
350
353
})
351
354
352
355
// Convert to map for JSON output
@@ -373,7 +376,10 @@ func (mc *MetricsCollector) GetMetrics() map[string]interface{} {
373
376
374
377
// Sort by decreasing count
375
378
sort .Slice (domainCounts , func (i , j int ) bool {
376
- return domainCounts [i ].count > domainCounts [j ].count
379
+ if domainCounts [i ].count != domainCounts [j ].count {
380
+ return domainCounts [i ].count > domainCounts [j ].count
381
+ }
382
+ return domainCounts [i ].domain < domainCounts [j ].domain
377
383
})
378
384
379
385
// Take top 20
@@ -405,7 +411,10 @@ func (mc *MetricsCollector) GetMetrics() map[string]interface{} {
405
411
406
412
// Sort by decreasing count
407
413
sort .Slice (queryTypeCounts , func (i , j int ) bool {
408
- return queryTypeCounts [i ].count > queryTypeCounts [j ].count
414
+ if queryTypeCounts [i ].count != queryTypeCounts [j ].count {
415
+ return queryTypeCounts [i ].count > queryTypeCounts [j ].count
416
+ }
417
+ return queryTypeCounts [i ].qtype < queryTypeCounts [j ].qtype
409
418
})
410
419
411
420
// Take top 10
0 commit comments