Skip to the content.

OpenTelemetry Tracing

Crankfire can create an OpenTelemetry span for each request it sends, export the spans over OTLP, and propagate W3C trace context to the system under test. Your backend traces then line up with the load test that caused them.

Quick start

crankfire --target https://api.example.com \
  --concurrency 20 --duration 1m \
  --tracing-endpoint localhost:4317 \
  --tracing-insecure \
  --tracing-sample-rate 1.0

Note: Always set the sample rate explicitly, either --tracing-sample-rate or sample_rate:. When it is omitted, the effective value is currently 0, which samples no spans, even though --help shows a default of 1. Trace context is still propagated, but marked as not sampled.

Configuration

Tracing is enabled only when an endpoint is set, with --tracing-endpoint or tracing.endpoint.

Flag Config key (tracing.*) Effective default Description
--tracing-endpoint endpoint none (tracing off) OTLP collector address as host:port, without a scheme
--tracing-protocol protocol grpc OTLP transport: grpc or http (HTTP uses /v1/traces)
--tracing-service-name service_name $OTEL_SERVICE_NAME, else crankfire service.name resource attribute
--tracing-sample-rate sample_rate 0 when omitted (see the note above) 0.0–1.0; 1 = always, between 0 and 1 = trace-ID ratio
--tracing-insecure insecure false Plaintext connection to the collector (no TLS)
none propagate true when tracing is enabled Inject W3C traceparent/tracestate and baggage into outgoing requests
target: https://api.example.com
concurrency: 20
duration: 1m
tracing:
  endpoint: localhost:4317
  protocol: grpc
  service_name: checkout-load-test
  sample_rate: 0.1
  insecure: true
  propagate: true

Sampling is parent-based. A sample rate outside [0, 1] is an error.

Environment variables

What gets traced

The span covers the same interval as the latency Crankfire measures: building the request, the auth token lookup, the call itself, and reading the response.

Propagation works on every protocol:

Protocol Where trace context is injected
HTTP Request headers
WebSocket Handshake request headers
SSE Stream request headers
gRPC Outgoing metadata

To export spans without touching the target’s traces, set propagate: false. This option exists only in the config file.

Spans are exported in batches. Pending spans are flushed when the run ends, with a 5-second shutdown timeout.

Backend recipes

Jaeger (local)

docker run --rm -d --name jaeger -p 16686:16686 -p 4317:4317 -p 4318:4318 \
  jaegertracing/all-in-one:latest

crankfire --target http://localhost:8080 --total 500 \
  --tracing-endpoint localhost:4317 --tracing-insecure --tracing-sample-rate 1

Open http://localhost:16686 and look for the crankfire service.

OTLP over HTTP

crankfire --target https://api.example.com --duration 30s \
  --tracing-endpoint localhost:4318 --tracing-protocol http --tracing-insecure \
  --tracing-sample-rate 1

OpenTelemetry Collector or Grafana Tempo

Point Crankfire at the collector’s OTLP receiver:

tracing:
  endpoint: otel-collector.internal:4317
  protocol: grpc
  sample_rate: 0.2

Leave out insecure when the receiver uses TLS.

Honeycomb (or any vendor that authenticates with headers)

export OTEL_EXPORTER_OTLP_HEADERS="x-honeycomb-team=$HONEYCOMB_API_KEY"
crankfire --target https://api.example.com --duration 1m \
  --tracing-endpoint api.honeycomb.io:443 --tracing-sample-rate 0.1

Tips

See also: Configuration, Protocols.