Closed stefanKnott closed 8 years ago
What's the use case? AFAIU this is equivalent to issuing a single HTTP request which can't have any statistical significance and would be better handled without Vegeta.
However, I recognize the metrics code should handle this case for the sake of correctness.
The use case is testing the speed of a single http request -- we are using the library for a speedtest program. The only reason the issue was brought up was because a user accidentally entered this request.
I made the change myself locally to what I outlined above -- but if this use case doesnt fit your package then feel free to close this issue
If attacker.Attack(...) is ran with a rate of 1 and duration of 1 invalid results are returned as when m.Duration is calculated in lib/metrics.go it is set to equal 0 as m.Earliest and m.Latest will have the same value due to only one result being added to the metrics object. This causes an error when calculating the rate because of a divide by 0.
Perhaps to find correct rate for this use case -- would checking if m.Latest.Equal(m.Earliest) (they will only equal each other if rate=1 and dur=1) in metrics.Close() and if so set m.Latest to m.Latest.Add(m.Latencies.Total) be correct? This finds how long the one hit takes and can be used to then find a correct metrics.Rate.