Skip to content

Commit d380287

Browse files
committed
update docs + add changeset
1 parent 1701ddc commit d380287

File tree

7 files changed

+12
-10
lines changed

7 files changed

+12
-10
lines changed

book/src/libs/wasp/benchspy/loki_std.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,9 @@ var compareAverages = func(t *testing.T, metricName string, currentAsStringSlice
112112
assert.LessOrEqual(t, math.Abs(diffPrecentage), maxPrecentageDiff, "%s medians are more than 1% different", metricName, fmt.Sprintf("%.4f", diffPrecentage))
113113
}
114114

115-
compareAverages(
116-
t,
117-
string(benchspy.MedianLatency),
118-
currentAsStringSlice,
119-
previousAsStringSlice,
120-
1.0,
121-
)
115+
compareAverages(t, string(benchspy.MedianLatency), currentAsStringSlice, previousAsStringSlice, 1.0)
122116
compareAverages(t, string(benchspy.Percentile95Latency), currentAsStringSlice, previousAsStringSlice, 1.0)
117+
compareAverages(t, string(benchspy.Percentile99Latency), currentAsStringSlice, previousAsStringSlice, 1.0)
123118
compareAverages(t, string(benchspy.MaxLatency), currentAsStringSlice, previousAsStringSlice, 1.0)
124119
compareAverages(t, string(benchspy.ErrorRate), currentAsStringSlice, previousAsStringSlice, 1.0)
125120
```

book/src/libs/wasp/benchspy/real_world.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Let’s assume you want to ensure that none of the performance metrics degrade b
9090
hasFailed, error := benchspy.CompareDirectWithThresholds(
9191
1.0, // Max 1% worse median latency
9292
1.0, // Max 1% worse p95 latency
93+
1.0, // Max 1% worse p99 latency
9394
1.0, // Max 1% worse maximum latency
9495
0.0, // No increase in error rate
9596
currentReport, previousReport)

book/src/libs/wasp/benchspy/reports/standard_report.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Both query executors focus on the characteristics of the load generated by `WASP
1818
Predefined metrics for both include:
1919
- Median latency
2020
- 95th percentile latency
21+
- 99th percentile latency
2122
- Max latency
2223
- Error rate
2324

book/src/libs/wasp/benchspy/simplest_metrics.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ hasErrors, errors := benchspy.CompareDirectWithThresholds(
1515
// maximum differences in percentages for:
1616
1.0, // median latency
1717
1.0, // p95 latency
18+
1.0, // p99 latency
1819
1.0, // max latency
1920
1.0, // error rate
2021
currentReport,
@@ -29,6 +30,7 @@ If there are errors they will be returned as `map[string][]errors`, where key is
2930
> Both `Direct` and `Loki` query executors support following standard performance metrics out of the box:
3031
> - `median_latency`
3132
> - `p95_latency`
33+
> - `p99_latency`
3234
> - `max_latency`
3335
> - `error_rate`
3436
@@ -43,6 +45,8 @@ Generator: vu1
4345
+-------------------------+---------+---------+---------+
4446
| 95th_percentile_latency | 50.7387 | 50.7622 | 0.0463 |
4547
+-------------------------+---------+---------+---------+
48+
| 99th_percentile_latency | 54.8192 | 51.0124 | -7.4624 |
49+
+-------------------------+---------+---------+---------+
4650
| max_latency | 55.7195 | 51.7248 | -7.1692 |
4751
+-------------------------+---------+---------+---------+
4852
| error_rate | 0.0000 | 0.0000 | 0.0000 |

wasp/.changeset/v1.51.1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Add p99 metric to BenchSpy's Direct and Loki standard Query Executors

wasp/benchspy/direct.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,10 @@ func (dqe *DirectQueryExecutor) standardQuery(standardMetric StandardLoadMetric)
270270
}
271271
return p95Fn, nil
272272
case Percentile99Latency:
273-
p95Fn := func(responses *wasp.SliceBuffer[*wasp.Response]) (float64, error) {
273+
p99Fn := func(responses *wasp.SliceBuffer[*wasp.Response]) (float64, error) {
274274
return stats.Percentile(responsesToDurationFn(responses), 99)
275275
}
276-
return p95Fn, nil
276+
return p99Fn, nil
277277
case MaxLatency:
278278
maxFn := func(responses *wasp.SliceBuffer[*wasp.Response]) (float64, error) {
279279
return stats.Max(responsesToDurationFn(responses))

wasp/benchspy/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const (
6868
ErrorRate StandardLoadMetric = "error_rate"
6969
)
7070

71-
var StandardLoadMetrics = []StandardLoadMetric{MedianLatency, Percentile95Latency, MaxLatency, ErrorRate}
71+
var StandardLoadMetrics = []StandardLoadMetric{MedianLatency, Percentile95Latency, Percentile99Latency, MaxLatency, ErrorRate}
7272

7373
type StandardResourceMetric string
7474

0 commit comments

Comments
 (0)