-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
API does not return detailed or per-request metrics #1875
Comments
This will very likely never be added to the built-in REST API, sorry. For one thing, it there's nothing that "consumes" the generated metric samples, it will be one giant built-in memory leak. We already have a small taste of that, because of the current So, this has to be done as an output (https://k6.io/docs/getting-started/results-output#external-outputs). Outputs are explicitly enabled with the And, as you've correctly surmised in #1730 (comment), the upcoming output extensions in k6 v0.31.0 can be used as a first step here. We will probably adopt some Prometheus/OpenMetrics output in the k6 core eventually, just because it's so popular. But the first iteration will be best done as an extension. |
Thanks @na-- I was thinking that API would only return the events for current moment in time the API is called, rather than filling a huge in-memory buffer. A "snapshot" approach like this works well for something like Prometheus which scrapes at intervals. I'm not familiar enough with the internals of k6 if this approach is feasible without filling up a buffer. Anyhow I think the output extension is a good route to investigate for this |
There would have to be some kind of a buffer, for sure. Or, at least, some time/count window, so we can have some sort of a bounded/circular buffer. But then we'd have to have some way of configuring it, and it'd still have some performance impact, even if it's not huge. As I said, the nice thing about outputs (and output extensions) is that they don't have costs if you don't enable them, and they are flexible enough for anything that has to do with metrics, so that's the way to go here. |
Feature Description
The REST API provides details of metrics for the currently running test. These metrics do not include any data for each of the requests or groups in the test.
These per-request metrics are available in the output (e.g. CSV) where you can see the request names, tags etc and the metrics for each one, but there is no way to access these via the API.
The use case would be for exporters or other tools to have real time access to the details of test requests.
E.g. I have created a Prometheus exporter for k6 but without access to the metrics of each request, it's of limited use.
https://github.com/benc-uk/k6-prometheus-exporter/
Suggested Solution (optional)
New API endpoints
/v1/metrics/requests
and/v1/metrics/requests/{request_name}
which could return a JSON list of requests AND for each request, the metrics
The text was updated successfully, but these errors were encountered: