Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add a standard deviation metric #515

Open
psicomante opened this issue Feb 23, 2018 · 3 comments
Open

How to add a standard deviation metric #515

psicomante opened this issue Feb 23, 2018 · 3 comments

Comments

@psicomante
Copy link

Hello,

k6 is a wonderful tool, thank you.

I wonder if is it possible to add a custom metric that calculates the standard deviation of some http time. I guess it's not possible to do it via Javascript bindings, am i correct?

Thank you.

@robingustafsson
Copy link
Member

Hi @psicomante, pardon the late reply. You're correct, it's currently not supported directly through the k6/metrics API (custom metrics), however you could output the result to JSON [1] and then use jq to query the data [2] and calculate the standard deviation [3]. You could either filter on the URL tag, create a custom tag for the requests you're interested in, or set up a custom metric (Trend) to track the response times that you could then filter on using jq.

[1] - https://docs.k6.io/docs/results-output#section-json-output
[2] - https://docs.k6.io/docs/results-output#section-processing-json-output
[3] - https://stackoverflow.com/questions/15101343/standard-deviation-of-an-arbitrary-number-of-numbers-using-bc-or-other-standard

@na--
Copy link
Member

na-- commented Oct 4, 2018

This should probably be implemented after we start using HDR histograms - #763
And it still should be something that's only calculated on demand, since it iterates over all of the metric values, but maybe as part of receiving the summary metrics at the end of the test (#351)?

@john-wd
Copy link

john-wd commented Sep 19, 2023

Is this suggestion still under the consideration from the k6 team?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants