Skip to content

Latest commit

 

History

History
77 lines (55 loc) · 2.25 KB

README.md

File metadata and controls

77 lines (55 loc) · 2.25 KB

xk6-opentelemetry logo xk6-opentelemetry

The xk6-opentelemetry project is a k6 extension that enables k6 users to generate random OpenTelemetry signals (metrics, logs, traces) for testing purposes.

Check the examples directory which contains some scripts to get started.

Features

  • Generate
    • ExportLogsServiceRequest
    • ExportMetricsServiceRequest (Types: gauge, sum, histogram)
    • ExportTraceServiceRequest
  • Set resource attributes

Usage

Docker

The easiest way to get started is to build the provided Docker image and run k6 scripts inside the container.

Build the image:

docker build -t xk6-opentelemetry .

Run a local k6 script:

docker run --rm -i xk6-opentelemetry run - <my-script.js

Local build

As the testing environment and scripts rely on sending messages to Kafka, the extension xk6-kafka needs to be integrated as well when creating the k6 binary.

Create the binary:

git clone [email protected]:thmshmm/xk6-opentelemetry.git && cd xk6-opentelemetry
xk6 build --with xk6-opentelemetry=. --with github.com/mostafa/xk6-kafka

or use Task:

task build-k6

Testing

Local environment

Start a local test environment including Kafka (Redpanda) and an instance of the OpenTelemetry Collector using Docker Compose. The OTel Collector is configured to read messages using the Kafka receiver and write all messages to STDOUT of the container.

Start:

task testing-up

Stop:

task testing-down

Examples

Execute:

./k6 run examples/<SCRIPT>.js

Run all examples:

task run-examples