Automation

Run OTel Studio in CI: Headless Mode and the Job API

Send known traffic through your pipeline on every change, and fail the build when it breaks.

A telemetry pipeline is code and configuration, so it deserves a pipeline test: after every change to a collector configuration, an alert rule or a dashboard, send known traffic through it and fail the build if something is wrong. OTel Studio's command-line mode and Job API are built for that.

Command-line mode

The same image that serves the web interface runs headless. It starts, generates traffic for a fixed time, flushes everything and exits with a status code:

Exit codeMeaning
0Ran for the full duration and exported successfully
1Bad arguments or invalid configuration
2Collector unreachable at start-up
3Error during the run

Describe the traffic in a small YAML file. Listing a scenario or simulator enables it; omit it to leave it off:

# load.yaml
service: ci-check
env: ci
scenarios:
  ecommerce:
    rateMs: 1000        # ms between batches
    batchSize: 3        # requests per batch
    errorRate: 0.05     # 5% of requests fail
infrastructure:
  hostCount: 20
containers:
  count: 20
  serviceCount: 6

Run it. The endpoint can come from the file, a flag or the standard OpenTelemetry variables; the token comes from the environment:

docker run --rm \
  -e OTEL_STUDIO_BEARER_TOKEN="$OTLP_TOKEN" \
  -v "$PWD/load.yaml:/app/load.yaml:ro" \
  ghcr.io/xplurdata/otel-studio:latest \
  node dist/headless.js --config load.yaml --duration 2m \
  --endpoint https://collector.example.com:4318 --protocol http \
  --header "X-Scope-OrgID: ci" \
  --attr test.run=$GITHUB_RUN_ID

The --attr flag stamps a run-wide resource attribute on everything sent, so you can find exactly this run's data afterwards. The container has no shell and needs none: the command is the program.

A GitHub Actions example

name: pipeline-check
on: [pull_request]
jobs:
  telemetry:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Generate test traffic
        env:
          OTLP_TOKEN: ${{ secrets.OTLP_TOKEN }}
        run: |
          docker run --rm -e OTEL_STUDIO_BEARER_TOKEN="$OTLP_TOKEN" \
            -v "$PWD/ci/load.yaml:/app/load.yaml:ro" \
            ghcr.io/xplurdata/otel-studio:latest \
            node dist/headless.js --config load.yaml --duration 90s \
            --endpoint "${{ vars.OTLP_ENDPOINT }}" --protocol http \
            --attr test.run=${{ github.run_id }}
      - name: Check the data arrived
        run: ./ci/assert-data-arrived.sh ${{ github.run_id }}

The first step fails the job on a non-zero exit code. The second is yours: query your backend for records with test.run equal to the run ID and fail if the count is zero or too low. That closes the loop — the pipeline is proven end to end, not just "the exporter did not complain".

Settings you can pass without a config file

Flags cover the common cases: --signals traces,logs,metrics, --hosts, --providers, --regions, --cpu, --mem, --os, --rate and --error-rate. If you set no endpoint on the command line or in the file, the standard OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_PROTOCOL and OTEL_EXPORTER_OTLP_HEADERS variables are used. The configuration file and flags take precedence over them.

The Job API: many runs from one place

When you need several runs at once — different tenants, different load shapes, several environments — run the Job API and start them over HTTP. Each run is its own isolated process with its own endpoint, credentials and settings, and up to 25 can be active at once:

docker run -d --name otel-studio-api -p 3100:3100 \
  -e API_TOKEN="a-secret-of-at-least-16-characters" \
  ghcr.io/xplurdata/otel-studio:latest node dist/api.js

curl -X POST http://localhost:3100/v1/runs \
  -H "Authorization: Bearer $API_TOKEN" -H "Content-Type: application/json" \
  -d '{
    "endpoint": "https://collector.example.com:4318",
    "protocol": "http",
    "duration": "10m",
    "bearerToken": "...",
    "headers": { "X-Scope-OrgID": "tenant-1" },
    "resourceAttributes": { "test.run": "nightly-42" },
    "signals": ["traces", "logs"],
    "scenarios": { "ecommerce": { "rateMs": 1000, "errorRate": 0.05 } }
  }'

curl -H "Authorization: Bearer $API_TOKEN" http://localhost:3100/v1/runs/<id>      # state, timing, exit code
curl -X DELETE -H "Authorization: Bearer $API_TOKEN" http://localhost:3100/v1/runs/<id>   # stop early

Endpoint tokens in a request are passed to the run through its environment and never written to disk; run views show header names only. Keep port 3100 off the public internet.

Tips. Give CI its own tenant or dataset so test data is easy to find and delete. Keep durations short (one to two minutes is usually plenty). Pin the image to a version tag in CI so a new release never changes your pipeline unexpectedly.

Keep going