Skip to content

Commit 900dd5d

Browse files
committed
refactor: simplify some code paths
Signed-off-by: Andrea Terzolo <andreaterzolo3@gmail.com>
1 parent 08d5aa3 commit 900dd5d

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

checks/net.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -800,17 +800,18 @@ func aggregateStats(stats []http.RequestStat) (int, *ddsketch.DDSketch) {
800800
latencies := emptySketch()
801801

802802
for _, stat := range stats {
803-
requestCount += stat.Count
804803
if stat.Count == 0 {
805804
continue
806-
} else if stat.Count == 1 {
805+
}
806+
807+
requestCount += stat.Count
808+
809+
if stat.Count == 1 {
807810
latencies.Add(stat.FirstLatencySample * nsToS)
808-
} else {
809-
if stat.Latencies != nil {
810-
var scaled = emptySketch()
811-
scaled = stat.Latencies.ChangeMapping(scaled.IndexMapping, scaled.GetPositiveValueStore(), scaled.GetNegativeValueStore(), nsToS)
812-
latencies.MergeWith(scaled)
813-
}
811+
} else if stat.Latencies != nil {
812+
var scaled = emptySketch()
813+
scaled = stat.Latencies.ChangeMapping(scaled.IndexMapping, scaled.GetPositiveValueStore(), scaled.GetNegativeValueStore(), nsToS)
814+
latencies.MergeWith(scaled)
814815
}
815816
}
816817
return requestCount, latencies
@@ -1024,9 +1025,6 @@ func aggregateHTTPStats(httpStats map[http.Key]*http.RequestStats, sendForPath b
10241025
}
10251026

10261027
statusCodeGroup := statusCodeClassToString(statusCodeClass)
1027-
if statusCodeGroup == "" {
1028-
continue
1029-
}
10301028
connKey := getConnectionKeyForHTTPStats(statKey)
10311029
connStats := regroupedStats[connKey]
10321030

0 commit comments

Comments
 (0)