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_indexThe extension can send OTLP/gRPC and OTLP/HTTP telemetry to collectors and can
also forward k6 output metrics through the otel-gen output.
Features
| Feature | Concrete example |
|---|---|
| Topology DSL | services.frontend.operations[].calls[] models service edges |
| Journey execution | runJourney("checkout") creates one synthetic trace |
| Fault injection | error_rate_override, latency_inflation, disconnect, crash |
| Per-operation signals | log_events, metrics, profile emit structured logs, custom metrics, and flamegraphs |
| Span links & exemplars | messaging edges link producer↔consumer spans; metrics carry trace_id / span_id |
| Pyroscope profiles | synthetic flamegraphs with fault-linked incident variants for diff profiling |
| OTLP egress | gRPC 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 export | go run ./cmd/xk6-otel-gen-schema > topology.schema.json |
| Topology visualization | go 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.10Next steps
- Quick Start — build k6 and run synthetic traffic.
- Building — build a custom k6 binary with this extension.
- Usage — the JavaScript API.