Skip to content
Getting Started

Getting Started

xk6-otel-gen is a k6 extension that synthesizes OpenTelemetry traces, metrics, and logs from a declarative YAML topology. It lets you model microservice graphs, journeys, and faults without building real services.

journeys:
  checkout:
    weight: 1.0
    steps:
      - service: frontend
        operation: get_index

The extension can send OTLP/gRPC and OTLP/HTTP telemetry to collectors and can also forward k6 output metrics through the otel-gen output.

Features

FeatureConcrete example
Topology DSLservices.frontend.operations[].calls[] models service edges
Journey executionrunJourney("checkout") creates one synthetic trace
Fault injectionerror_rate_override, latency_inflation, disconnect, crash
Per-operation signalslog_events, metrics, profile emit structured logs, custom metrics, and flamegraphs
Span links & exemplarsmessaging edges link producer↔consumer spans; metrics carry trace_id / span_id
Pyroscope profilessynthetic flamegraphs with fault-linked incident variants for diff profiling
OTLP egressgRPC on localhost:4317 or HTTP on localhost:4318; profiles via profilesEndpoint
k6 output integration--out otel-gen=endpoint=localhost:4317 forwards k6 output
JSON Schema exportgo run ./cmd/xk6-otel-gen-schema > topology.schema.json
Topology visualizationgo run ./cmd/xk6-otel-gen-viz -input topology.yaml -output topology.html

Example fault:

faults:
  - target: operation:payment.authorize_card
    kind: error_rate_override
    severity:
      probability: 1.0
      value: 0.10

Next steps

  • Quick Start — build k6 and run synthetic traffic.
  • Building — build a custom k6 binary with this extension.
  • Usage — the JavaScript API.