grafana / xk6-output-opentelemetry

A k6 extension to output real-time test metrics in OpenTelemetry format.
GNU Affero General Public License v3.0
11 stars 4 forks source link
k6 k6-output opentelemetry xk6

xk6-output-opentelemetry

A work in progress k6 extension to output real-time test metrics in OpenTelemetry metrics format.

[!WARNING]
It's work in progress implementation and not ready for production use.

Configuration options

It's worth to mention that the extension is using the OpenTelemetry Go SDK that's why it's possible to use the configuration environment variables from the SDK. However, if the K6_OTEL_* environment variables are set, they will take precedence over the SDK configuration.

k6-specific configuration

OpenTelemetry-specific configuration

TLS configuration

If TLS configuration is provided, the exporter will use it.

GRPC exporter

[!TIP] Also, you can use OpenTelemetry SDK configuration environment variables.

HTTP exporter

[!TIP] Also, you can use OpenTelemetry SDK configuration environment variables.

Build

To build a k6 binary with this extension, first ensure you have the prerequisites:

make build

This will result in a k6 binary in the current directory.

Local usage

  1. You could run a local environment with OpenTelemetry collector (Grafana Alloy), Prometheus backend and Grafana (http://localhost:3000/):
docker-compose up -d
  1. Run with the just build `k6:
 K6_OTEL_GRPC_EXPORTER_INSECURE=true K6_OTEL_METRIC_PREFIX=k6_ ./k6 run --tag testid=1 -o xk6-opentelemetry examples/script.js
  1. Open Grafana http://localhost:3000/ and navigate to the k6 OpenTelemetry Prometheus dashboard.

Demo k6's OpenTelemetry