grafana / k6

A modern load testing tool, using Go and JavaScript - https://k6.io
GNU Affero General Public License v3.0
25.55k stars 1.26k forks source link

Sending summary to remote endpoint #3732

Closed ameetpal closed 2 months ago

ameetpal commented 5 months ago

Feature Description

Hey,

Our team is providing k6 testing as a platform in our org and other teams use our platform to test their services. To collect the test result summary, we are exposing an endpoint and in test scripts we have to overide the handleSummery function and write the code to send it to a server. As indicated in K6 docs https://k6.io/docs/results-output/end-of-test/custom-summary/#example-send-data-to-remote-server

However, every test script have to export handleSummary function, So we were looking into the solution were we can provide a default behaviour for sending the summary data.

We have already raised this issue in Grafana community and we were suggested to listen to Event in custom K6 extension, so we tried making extension for this but since internal state like events are only exposed in JS extension, user still have to import that extension in app. Is there a way to make use a extension in k6 without needing to import in test script file ?

Or may be we can find some other way to tranferr summery outside of th testing machine

Suggested Solution (optional)

No response

Already existing or connected issues / PRs (optional)

https://github.com/grafana/k6/issues/3683

ameetpal commented 4 months ago

Any suggestion here, how we can send summary without explicitly importing a extension ? AlsoIs there any plugin like extension we can create for k6 ?

olegbespalov commented 4 months ago

Any suggestion here, how we can send summary without explicitly importing a extension ?

There is no such functionality apart from https://k6.io/docs/results-output/end-of-test/custom-summary/#example-send-data-to-remote-server

AlsoIs there any plugin like extension we can create for k6 ?

Yes, you could create your own extension by following the https://k6.io/docs/extensions/get-started/create/

However, as we said and if I'm getting you right if your extension will be used an internal event API from https://github.com/grafana/k6/pull/3730 it's highly possible that it will stop work at some point since we do consider this API internal for now https://github.com/grafana/k6/pull/3682#issuecomment-2061363537

codebien commented 2 months ago

Closing as at the moment we don't plan to offer this functionality, it can be solved with other already available features. Recap of the solutions: