Stanley Ipkiss
Stanley Ipkiss

Reputation: 11

Customize percentages displayed in report.html by locust

I'm trying to add 98% in the locust report. The percentage is calculated by the application, in appears in the terminal. I just want it to appear in the html report next to the others. Any ideas on how to do that? report.html

I tried using PERCENTILES_TO_REPORT, but this option actually calculates custom percentiles. 98% is already calculated, it just needs to show up in the report.

Upvotes: 1

Views: 347

Answers (2)

TayJen
TayJen

Reputation: 349

They actually added this to their configuration (look at the bottom of the page): https://docs.locust.io/en/stable/configuration.html#configuration-file

Now you can edit the percentiles directly in the locust.stats at the beginning of the python file, like this:

import locust.stats

locust.stats.PERCENTILES_TO_REPORT = [0.8, 0.9, 0.95, 0.99, 0.995, 0.999]
locust.stats.PERCENTILES_TO_CHART = [0.8, 0.9, 0.95, 0.99, 0.995, 0.999]
locust.stats.PERCENTILES_TO_STATISTICS = [0.8, 0.9, 0.95, 0.99, 0.995, 0.999]

Upvotes: 0

Solowalker
Solowalker

Reputation: 2866

It looks like support for customizing percentiles was recently added to Locust.

https://github.com/locustio/locust/pull/2313

I haven't tried it, but based on the committed tests it seems you'd use it like this:

from locust.stats import PERCENTILES_TO_CHART

PERCENTILES_TO_CHART[0] = 0.9
PERCENTILES_TO_CHART[1] = 0.4

Upvotes: 1

Related Questions