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

Field with the name of the request in k6 stats #271

Open
daylikon opened this issue Jan 25, 2024 · 6 comments · May be fixed by #272
Open

Field with the name of the request in k6 stats #271

daylikon opened this issue Jan 25, 2024 · 6 comments · May be fixed by #272

Comments

@daylikon
Copy link

Hello @mostafa!

At this moment, when generating a csv report and exporting metrics, you can see the metrics (for example, kafka_writer_write_seconds), the metric value, scenario name and to which topic message was sent in extra_tags for each request.

I want to somehow identify different requests that are sent to one topic in one scenario in stats, for example, using the name, metadata, tags/extra_tags fields. Is there a way to set these fields now?

If not, is it possible to issue this as a feature request?

Regards, Andrew

@mostafa
Copy link
Owner

mostafa commented Jan 25, 2024

Hey @daylikon,

k6 supports custom metrics: https://grafana.com/docs/k6/latest/using-k6/metrics/create-custom-metrics/
And with custom metrics, you can also have tags, like this counter metric example: https://grafana.com/docs/k6/latest/javascript-api/k6-metrics/counter/

@daylikon
Copy link
Author

Yes, I can use k6 custom metrics, but I want to use xk6-kafka metric value (kafka_writer_write_seconds/kafka_reader_read_seconds/etc).

Right now writer returns undefined, the difference between the time calculated between writer.produce() is very different from the metric.

Is there a way to get plugin metrics after sending or reading a message, so that they can then be used in custom metrics?

@mostafa
Copy link
Owner

mostafa commented Jan 26, 2024

@daylikon

I don't think so, unless you export them while the test is running.

@daylikon
Copy link
Author

@mostafa

So I’m thinking about how to export metrics while the test is running. Messages are written in the same topic, but the “name” is different.

Now in the csv and given output plugin, if take the kafka_writer_write_seconds metric, I can compare by topic, but since the payload of the messages is different, I want to aggregate these messages by “name,” but now it’s impossible to do that.

@mostafa
Copy link
Owner

mostafa commented Jan 26, 2024

@daylikon

Currently only static tags are added to reader and writer metrics based on the metrics provided from the kafka-go module's readerStats and writerStats. You can modify the xk6-kafka's reportReaderStats and reportWriterStats functions to include dynamic tags and try to see if it works the way you expect.

@daylikon daylikon linked a pull request Jan 31, 2024 that will close this issue
@mostafa
Copy link
Owner

mostafa commented Feb 5, 2024

@daylikon

Ref: #272 (comment)

@mostafa mostafa linked a pull request Apr 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants