-
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
Metric for http sent/recv size #2283
Comments
This is going to be tricky to implement, since right now the Line 180 in 5c14dae
and Lines 97 to 115 in 5c14dae
So all of the traffic, regardless of protocol, passes through that... I guess we could expose the creation of custom Making the default For now, as a partial workaround, you could use per-scenario tags or the new Also, please use the issue templates instead of creating blank issues in the future 🙏 |
Thank you for the detailed answer. I will try some variants. |
No need to close this, it's a valid feature request! And actually, this might be more easily (and immediately) solved by an addition to #2260. We should be able to easily and atomically expose the So, users will be able to do something like this: import http from "k6/http";
import ws from 'k6/ws';
import exec from 'k6/execution';
import { Trend } from "k6/metrics";
const bytesWrittenHTTP = new Trend('bytes_writen_http');
const bytesWrittenWS = new Trend('bytes_writen_ws');
export default function () {
http.get('https://test.k6.io')
// ... a bunch of other HTTP requests
let bytesWrittenBeforeWSConn = exec.vu.dataSentInIteration;
bytesWrittenHTTP.add(bytesWrittenBeforeWSConn);
ws.connect(url, params, function (socket) { /* ... */});
bytesWrittenWS.add(exec.vu.dataSentInIteration - bytesWrittenBeforeWSConn);
// ... anything else you want ...
// we can take snapshots of dataSentInIteration at any point in the iteration :)
} It's a bit tricky to keep track, but it should allow pretty much everything you want. And it will get especially tricky when you have asynchronous things happening in a single VU (#2228), there the initial approach I suggested will probably be much easier to use, but I still think this is probably worth it 🤷♂️ |
We have decided not to implement this via the We won't be implementing this in the current HTTP API, but it will be part of the new API (initial design document), which we're starting to work on now. I'll close this issue in the meantime, since we want to work with a clear roadmap. |
What can you say about the sent/recv metric (with the Trend type for min/max/percentiles) for all protocols (for example, http_req_send_size/http_req_recv_size) ?
It's useful for some cases, when data_received/data_sent is not enough.
The text was updated successfully, but these errors were encountered: