Telemetry
What each training run logs, the OpenTelemetry metrics, and the OpenTelemetry design.
6 min read
OpenTelemetry metrics done; no spans or collector
What a training run logs, and what it and the physlab CLI send over OpenTelemetry. Each run writes
metrics.jsonl plus a few other files. Learning curves stay file-based on purpose
(why); OpenTelemetry metrics cover speed and
health, charted live in the Command Center.
What exists: metrics.jsonl#
The learner (python/physlab_rl) appends one JSON object per line to runs/<run>/metrics.jsonl. Every
line has a kind field, the x axis global_step (agent steps summed over all envs) and the PPO
update number. runs/ is gitignored, so these files live only on the machine that trained.
kind | Written | Main 1v1 run | What it holds |
|---|---|---|---|
train | every update (131,072 agent steps by default) | 7,809 lines | throughput, timings, learning rate, rolling episode statistics, reward components, PPO diagnostics |
eval | every held-out evaluation (--eval-every) | 98 lines | scores against each opponent with Wilson 95% intervals, touches, shots, episode length |
rating | after each match-task evaluation | 98 lines | every player's Bradley–Terry rating, ball_chaser fixed at 1000 |
The main run's file (runs/selfplay/main-1v1-s11/metrics.jsonl) is 85 MB: each train line carries
about 210 keys, most of them per-component reward sums.
Key families#
train lines:
| Keys | Meaning |
|---|---|
global_step, update, wall_s | x axes: agent steps, update number, seconds since start |
sps, sps_update | global_step / wall_s (a running average, evaluations included); this update's own rate |
time/env_s, time/inference_s, time/update_s, time/other_s, time/opponent_launch_s | seconds per update by phase. The learner-speed work adds time/cycle_s, time/h2d_s, time/act_launch_s, time/d2h_wait_s, time/bookkeeping_s, time/update_wait_s |
lr, reward/step_mean, reward/return_scale | learning rate; mean reward per step; the return scaler |
train/* | over a rolling window of the last 4096 training episodes: success_rate, return_mean, length_mean, terminated_frac, ticks_to_success_mean |
step_comp/<c> | per-step mean of each reward component <c>, including potentials as pot:<c> |
ep_comp/<c>, ep_comp_weighted/<c> | per-episode sums, unweighted and weighted. Match tasks add /blue/ and /orange/ variants |
ppo/* | pg_loss, v_loss, entropy, approx_kl, clipfrac, explained_variance, adv_mean, adv_std, value_mean, return_mean, epochs, samples, minibatches, minibatch_size, approx_kl_first_mb, aux_*; with an overlapped update also update and behaviour_kl |
match/* (match tasks) | episode_length_s, goal_frac, and touch steps, shots, demos and goals per car-minute and per episode |
selfplay/*, vs_pool/*, learner_steps (match tasks) | learner share of samples, pool size, Blue's win/draw/loss rates by opponent kind |
eval lines:
Single-agent tasks:
eval/success_rate,eval/mean_ticks_to_success,eval/mean_return,eval/mean_length,eval/episodes,eval/wall_s.Match tasks:
eval/<opponent>/<k>forball_chaserand each earlier checkpointprev_<i>, where<k>isscore,win_rate,draw_rate,loss_rate, their*_ci95_lo/*_ci95_hi,mean_length_s,touches_per_car_minute,opp_touches_per_car_minute,shots_per_episode,demos_per_episodeandopponent. Pluseval/prev_mean_scoreandeval/success_rate(the score vsball_chaser, the key behindbest.pt).
rating lines: rating/current (the evaluated checkpoint), rating/ball_chaser and a ratings object with every player's rating.
The authoritative list is in Training environment → Run directory and Logging (match tasks).
Other run artifacts#
| File | What it records |
|---|---|
manifest.json | immutable: command line, git revision, source hashes, task JSON, every hyperparameter, seeds, library versions, GPU and driver |
summary.json | stop reason, steps, wall time, mean SPS, final and best evaluation, steps to 50/80/90% |
ratings.json, league/ratings.json | in-run and league ratings |
checkpoints/step_<n>.pt, best.pt, final.pt | model, optimiser and normaliser state at each evaluation |
*.gpu-before.txt, *.gpu-after.txt (in runs/perf/ab/) | nvidia-smi snapshots around the learner-speed A/B runs |
profile/trace.json | a torch.profiler trace, only with train.py --profile-updates START:COUNT |
What reads it#
This site: the Training progress charts are snapshots of
metrics.jsonl, taken at build time.just watchprints each checkpoint's evaluation score frommetrics.jsonlnext to the episode.just bench-learnerreports medians of thetime/*phases per flag set.The Command Center charts every metric of running and finished runs live, with checkpoints and ratings. It runs on the training machine only.
OpenTelemetry metrics#
The learner and the physlab CLI export OpenTelemetry metrics over OTLP/HTTP JSON, to the Command
Center (http://localhost:4321/v1/metrics) unless an endpoint variable names another, however
they are started. When it isn't running, nothing arrives; training prints one warning and carries
on.
| Variable | Effect |
|---|---|
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT | full URL to send to instead |
OTEL_EXPORTER_OTLP_ENDPOINT | base URL; /v1/metrics is appended |
OTEL_SDK_DISABLED=true | turns export off |
OTEL_METRIC_EXPORT_INTERVAL | export period in ms (default 5000) |
The Python tests never export.
| Source | Metrics | Attributes |
|---|---|---|
| Training, every update | physlab.train.steps, .updates, .episodes (counters); .throughput (this update's steps/s), .cycle.duration, .phase.duration (env, inference, update and other, which add up to the cycle), .part.duration (parts of inference, and the update job), .learning_rate, .reward.step_mean, .success_rate, .return_mean, .episode_length | task; phase, part |
| Training, PPO | physlab.ppo.policy_loss, value_loss, entropy, approx_kl, clip_fraction, explained_variance | task |
| Training, match tasks | physlab.match.episode_length, goal_fraction, touch_rate; physlab.selfplay.pool_size, learner_fraction | task |
| Training, evaluations | physlab.eval.score (success rate, or the score vs ball_chaser), .duration, .rating, .runs; physlab.train.checkpoints; physlab.train.stops | task; reason |
| Training, hardware | physlab.env.utilization (share of the env threads' time spent stepping), physlab.env.threads, physlab.gpu.memory | task; state |
physlab run | physlab.sim.run.duration, physlab.sim.tick_rate | mode |
physlab compare | physlab.compare.position_error.max, velocity_error.max, diverged, for the latest comparison | body |
physlab bench | physlab.bench.arena.tick_rate, physlab.bench.env.step_rate | layout, mem_mode; task, threads |
Labels are kept few: no run id, seed or scenario, so a training run adds about 40 series. Per-scenario and per-episode detail stays in the files.
The OpenTelemetry design#
The design separates two kinds of telemetry:
Execution telemetry says where time goes and where failures happen. That is OpenTelemetry's job.
Learning telemetry says whether a policy improves: learning curves, evaluations, checkpoints, replays. A trace backend does not replace it.
The planned architecture:
Rust sim / environment workers ─┐
Rust trainer or Python learner ──┼── OTLP (local batching) ── Alloy or OTel Collector
Scenario/benchmark CLI ─────────┘ ├── Tempo (traces)
├── Mimir / Prometheus (metrics)
└── Loki (logs)What it specifies:
Instrumentation. Rust
tracingspans with the OpenTelemetry SDK and OTLP exporters, and Python OpenTelemetry in the learner, joined byrun_idand trace propagation. Endpoints, sampling and retention come from config, never hard-coded.Spans, low cardinality and sampled.
training.run,training.rollout,training.ppo_update,training.evaluate,scenario.reset,scenario.compare,checkpoint.save,physics.benchmark, with child spans such aspolicy.inference_batchandreward.calculate_batch. Never a span per car, tick or match.Metric groups. Physics throughput, training throughput, PPO diagnostics, task performance, physics fidelity and reliability (worker restarts, NaNs, exporter drops).
Cardinality. No
episode_id,scenario_seedorrun_idlabels on exported metrics. Per-episode detail stays in artifact files.Performance rule. Profile an uninstrumented baseline first and check telemetry's effect on end-to-end steps/s.
First dashboards. Training health, CPU/GPU bottlenecks, curriculum, physics fidelity, and a one-run drill-down from
run_idto manifest, checkpoints and replays.
How today's files map to the design#
| Design item | Today |
|---|---|
| Immutable run manifest | done: manifest.json |
| Learning curves with step count as x axis | done: metrics.jsonl (global_step) |
| PPO diagnostics, task performance metrics | done: ppo/*, eval/*, match/* keys |
| Training throughput by phase | done: time/* in the file, physlab.train.phase.duration exported |
| Training-health dashboard | done: the Command Center, from the files rather than exported metrics |
| OTLP metric export | done: OpenTelemetry metrics, to the Command Center |
| Spans, collector, Grafana stack | done: training spans, NVTX ranges and a local Grafana stack (Tracing, profiling and machine load) |
| Reliability metrics (NaNs, restarts, exporter drops) | partial: physlab.train.stops counts non-finite-loss stops; no restart or exporter-drop metrics |
| Physics-fidelity metrics | partial: the latest physlab compare errors; per-scenario results live in the JSON reports, which the Command Center charts |
The intended order puts OpenTelemetry and learning dashboards after a first PPO policy, with small baselines instrumented earlier.