"Exploring Direct Event Consumption in k6: Seeking Alternatives to handleSummary() Override"

“Hello everyone, I’m looking for a way to consume (read) k6 events such as start, stop, error, and complete. Currently, I’m overriding the export function handleSummary(data) {} to get the data and then calling a remote server to save it. Is there any other method or way to directly read these events in k6? Any insights or suggestions would be greatly appreciated. Thank you!”

Hi @saik6 , Welcome to the community forum!

You can subscribe some type of events (k6/event/type.go at 47c5bb0f5608897f6961b9cb2260357a824acbfe · grafana/k6 · GitHub) in a custom k6 extension, but I don’t think you can do it in the test javascript script only.

If you want to send the test metrics to a remote server, you have some options:

I hope my answer helps.