Skip to content

Commit

Permalink
Add more error checking
Browse files Browse the repository at this point in the history
Adding more error checking of values.

Signed-off-by: Joe Talerico <[email protected]>
  • Loading branch information
Joe Talerico committed Oct 30, 2023
1 parent 4e93887 commit 7cb96db
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions pkg/archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,34 @@ func BuildDocs(sr result.ScenarioResults, uuid string) ([]interface{}, error) {
ClientNodeLabels: r.ClientNodeLabels,
AcrossAZ: r.AcrossAZ,
}
d.UDPLossPercent, _ = result.Average(r.LossSummary)
d.TCPRetransmit, _ = result.Average(r.RetransmitSummary)
d.Throughput, _ = result.Average(r.ThroughputSummary)
d.Latency, _ = result.Average(r.LatencySummary)
UDPLossPercent, e := result.Average(r.LossSummary)
if e != nil {
logging.Warn("Unable to process udp loss, setting value to zero")
d.UDPLossPercent = 0
} else {
d.UDPLossPercent = UDPLossPercent
}
TCPRetransmit, e := result.Average(r.RetransmitSummary)
if e != nil {
logging.Warn("Unable to process tcp retransmits, setting value to zero")
d.TCPRetransmit = 0
} else {
d.TCPRetransmit = TCPRetransmit
}
Throughput, e := result.Average(r.ThroughputSummary)
if e != nil {
logging.Warn("Unable to process throughput, setting value to zero")
d.Throughput = 0
} else {
d.Throughput = Throughput
}
Latency, e := result.Average(r.LatencySummary)
if e != nil {
logging.Warn("Unable to process latency, setting value to zero")
d.Latency = 0
} else {
d.Latency = Latency
}
docs = append(docs, d)
}
return docs, nil
Expand Down

0 comments on commit 7cb96db

Please sign in to comment.