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.

kindWrittenMain 1v1 runWhat it holds
trainevery update (131,072 agent steps by default)7,809 linesthroughput, timings, learning rate, rolling episode statistics, reward components, PPO diagnostics
evalevery held-out evaluation (--eval-every)98 linesscores against each opponent with Wilson 95% intervals, touches, shots, episode length
ratingafter each match-task evaluation98 linesevery 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:

KeysMeaning
global_step, update, wall_sx axes: agent steps, update number, seconds since start
sps, sps_updateglobal_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_sseconds 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_scalelearning 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> for ball_chaser and each earlier checkpoint prev_<i>, where <k> is score, 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_episode and opponent. Plus eval/prev_mean_score and eval/success_rate (the score vs ball_chaser, the key behind best.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#

FileWhat it records
manifest.jsonimmutable: command line, git revision, source hashes, task JSON, every hyperparameter, seeds, library versions, GPU and driver
summary.jsonstop reason, steps, wall time, mean SPS, final and best evaluation, steps to 50/80/90%
ratings.json, league/ratings.jsonin-run and league ratings
checkpoints/step_<n>.pt, best.pt, final.ptmodel, 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.jsona 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 watch prints each checkpoint's evaluation score from metrics.jsonl next to the episode.

  • just bench-learner reports medians of the time/* 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.

VariableEffect
OTEL_EXPORTER_OTLP_METRICS_ENDPOINTfull URL to send to instead
OTEL_EXPORTER_OTLP_ENDPOINTbase URL; /v1/metrics is appended
OTEL_SDK_DISABLED=trueturns export off
OTEL_METRIC_EXPORT_INTERVALexport period in ms (default 5000)

The Python tests never export.

SourceMetricsAttributes
Training, every updatephyslab.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_lengthtask; phase, part
Training, PPOphyslab.ppo.policy_loss, value_loss, entropy, approx_kl, clip_fraction, explained_variancetask
Training, match tasksphyslab.match.episode_length, goal_fraction, touch_rate; physlab.selfplay.pool_size, learner_fractiontask
Training, evaluationsphyslab.eval.score (success rate, or the score vs ball_chaser), .duration, .rating, .runs; physlab.train.checkpoints; physlab.train.stopstask; reason
Training, hardwarephyslab.env.utilization (share of the env threads' time spent stepping), physlab.env.threads, physlab.gpu.memorytask; state
physlab runphyslab.sim.run.duration, physlab.sim.tick_ratemode
physlab comparephyslab.compare.position_error.max, velocity_error.max, diverged, for the latest comparisonbody
physlab benchphyslab.bench.arena.tick_rate, physlab.bench.env.step_ratelayout, 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:

text
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 tracing spans with the OpenTelemetry SDK and OTLP exporters, and Python OpenTelemetry in the learner, joined by run_id and 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 as policy.inference_batch and reward.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_seed or run_id labels 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_id to manifest, checkpoints and replays.

How today's files map to the design#

Design itemToday
Immutable run manifestdone: manifest.json
Learning curves with step count as x axisdone: metrics.jsonl (global_step)
PPO diagnostics, task performance metricsdone: ppo/*, eval/*, match/* keys
Training throughput by phasedone: time/* in the file, physlab.train.phase.duration exported
Training-health dashboarddone: the Command Center, from the files rather than exported metrics
OTLP metric exportdone: OpenTelemetry metrics, to the Command Center
Spans, collector, Grafana stackdone: 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 metricspartial: 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.