k6 icon indicating copy to clipboard operation
k6 copied to clipboard

Sending summary to remote endpoint

Open ameetpal opened this issue 1 year ago • 2 comments

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 avatar May 05 '24 07:05 ameetpal

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

ameetpal avatar May 22 '24 06:05 ameetpal

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

olegbespalov avatar May 22 '24 06:05 olegbespalov

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:

  • Grafana Cloud that centralizes test runs and provides enrichment for test runs
  • Send the current summary to a remote server https://grafana.com/docs/k6/latest/results-output/end-of-test/custom-summary/#example-send-data-to-remote-server
  • If a very custom solution like this case is required then a dedicated Output extension is a better option. https://grafana.com/docs/k6/latest/extensions/create/output-extensions/

codebien avatar Jul 16 '24 08:07 codebien