Repository navigation
feat(telemetry): export rollout checkpoint metrics to Lens - #4730
Conversation
|
/ok to test e68e4bc |
Signed-off-by: Anish Mahishi <[email protected]>
e68e4bc to
14eed1b
Compare
|
/ok to test 14eed1b |
mehraakash
left a comment
There was a problem hiding this comment.
Reviewed the tee of the completed rollout save/restore dicts into Lens. No bugs found: the mapping, scalar/finite/non-negative filtering, and early-return dispatch all check out against the controller sources, and the four new unit tests pass locally with nemo-lens installed.
10 inline comments: 4 should-fix (docs placement and a contradictory restore sentence, the conftest comment, the one-directional save-only drift test) and 6 nits (docstrings, constants for series/attribute names, per-family exception handler, two cheap test cases). The _FROZEN reset in conftest is correct and should stay; only its comment is off.
Generated by Claude Code
Address review on the rollout checkpoint Lens export: - Move the rl.checkpoint.* docs after the rollout recovery section, restore the page intro, list the phase/category label values, and scope "do not sum" to save phases (restore phases are disjoint). - Declare RL_CHECKPOINT_* metric/attribute constants and derive registry keys with registry_key(). - Give the checkpoint family its own exception handler and a docstring. - Replace the save-only drift test with a bidirectional one in test_source_drift.py that follows every timing/rollout_* dict, including the restore dict assembled across setup.py and the controller. - Explain the vocabulary freeze reset in the telemetry conftest. Also emit one trace-only rl.sc.rollout_checkpoint.save span per completed save, rebuilt from the logged timings so the checkpoint path is untouched. It is gated by the checkpoint span group but carries no rl.bucket: the snapshot pump runs beside training, so an overhead bucket would double-count wall clock in goodput. TELEMETRY_WALL_TIME_METRIC moves to nemo_rl.telemetry.metrics and is re-exported by the logger. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
The save span needs only the tracer, but it sat behind ensure_metric_group_registered(), so a lens without the metric registry or a failed registration also dropped the trace. Emit it right after the is_exporting check instead. Add tests that the span survives a failed registration and that it parents to the current span (the job span in the controller). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
|
/ok to test 1bbcad6 |
Only completed saves reached Lens, so a run whose periodic snapshots
were all skipped (e.g. missing_trainer_anchor once training moves past
each durable trainer checkpoint) emitted no rl.checkpoint.* at all, the
same output as telemetry being off.
Tee the controller's per-attempt rollout/checkpoint_outcome dict as
rl.checkpoint.attempts{outcome, reason}, rl.checkpoint.attempt_duration
{outcome} and rl.checkpoint.seconds_since_last_success. Outcome and
reason are decoded from the one-hot flags and are fixed sets; a dict
that does not set exactly one of each is not counted. The label lists
are copied from rollout_checkpoint.py, which imports the GRPO stack, and
a source-drift test keeps them equal.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Anish Mahishi <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
main replaced the rl.step span attribute with RL_ITERATION_ATTR (rl.iteration). Use it for the rollout save span, set explicitly as checkpoint_finalize_span does, so the span carries the step the snapshot is anchored to rather than an inherited iteration_scope value. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
|
/ok to test ec5348f |
Base the integration on RL #4762 at 71d3b46. Preserve the integrated #4730 metrics and #4732 runtime diagnostics, the integration metric mappings, and Gym a2d8d9f0559faf14a05e8d4add2a00624c0dbcbd with ToolSimulationAgent recovery. Standalone telemetry: 279 passed, 5 skipped. Real local Ray telemetry: 5 passed. Syntax, lint, imports and formatting pass. Production-container prefix CPU tests are pending in Slurm job 1356058; GPU save/restore validation remains outstanding. Signed-off-by: Anish Mahishi <[email protected]>
terrykong
left a comment
There was a problem hiding this comment.
Exports the Single-Controller rollout-checkpoint numbers already logged to W&B into Lens/OTel, plus one span per completed save.
Good shape: labels stay bounded (sequence, step and wall time only ride the span), each family has its own warn_once, and the tee decodes the controller's dicts correctly; the 58 telemetry tests pass locally.
All 12 earlier threads (mehraakash, rrs45) are addressed at ec5348f. Nothing blocks the merge; every comment is a suggestion.
- (C1) Most important: the tee re-types the controller's attempt keys and Literals; share them through
metric_utils.py. - (C10)
metrics.mdcopies names and keys the code declares; point at the code across the file. This reverses the earlier ask for the 23-row table. - (C12) Shorten the PR's long code comments to what the code can't show.
- (C11) The staleness gauge can't drive an alert; fix two doc lines and show one that works.
- (C3) Same fix for the gauge's help text.
- (C4) Delete the duplicate
_FROZENreset inconftest.py. - (C5) Share the wall-time key and
"train_step"throughvocabulary.py. - (C6) The drift test misses
.update(...)keys. - (C7) The
rl.iterationcomment gives the wrong reason. - (C8) On v2 the actor, not the driver, emits most series.
- (C9) Document how to get useful percentiles from the 5 s default buckets.
Generated by Claude Code
Visual explainer: https://terrykong.github.io/gh-pages-poc/terryk/pr-4730-checkpoint-to-lens.html
Address review on the rollout checkpoint Lens export: - Share the snapshot-attempt prefix, value keys, reason-key helper and outcome/reason Literals through nemo_rl/algorithms/metric_utils.py, so the controller and the tee read one definition; drop the tee's copies and the Literal drift test. - Share TELEMETRY_WALL_TIME_METRIC and TELEMETRY_TRAIN_STEP_KEY through nemo_rl/telemetry/vocabulary.py instead of a logger re-export. - Teach the restore-key drift collector .update(...) and |=. - Remove the duplicate vocabulary _FROZEN reset main already performs. - Correct the staleness gauge help text and the rl.iteration comment. - metrics.md: point at the declaring code instead of copying tables, say which process emits what on v1 vs v2, document the default histogram buckets and the exponential-histogram env var, and warn that the staleness gauge cannot drive an alert (with one that can). - Shorten comments that restated docs or design history. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
|
/ok to test 7e993bc |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anish Mahishi <[email protected]>
|
/ok to test 216c77b |
Main's Lens export (#4730) sends each rollout save and restore metric through a fixed mapping, and a drift test fails when the controller logs a key the mapping does not name. Turn-level recovery logs four such keys: how long Gym held rollout dispatch for a save, the episodes that save could not capture, and the siblings a restore continued or restarted. gym_parked_seconds becomes a save duration phase, gym_parked. The other three are sibling counts, beside the reused and rerun siblings a restore already reports: continued, restarted and gym_restarted. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's Lens export (#4730) sends each rollout save and restore metric through a fixed mapping, and a drift test fails when the controller logs a key the mapping does not name. Turn-level recovery logs four such keys: how long Gym held rollout dispatch for a save, the episodes that save could not capture, and the siblings a restore continued or restarted. gym_parked_seconds becomes a save duration phase, gym_parked. The other three are sibling counts, beside the reused and rerun siblings a restore already reports: continued, restarted and gym_restarted. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's Lens export (#4730) sends each rollout save and restore metric through a fixed mapping, and a drift test fails when the controller logs a key the mapping does not name. Turn-level recovery logs four such keys: how long Gym held rollout dispatch for a save, the episodes that save could not capture, and the siblings a restore continued or restarted. gym_parked_seconds becomes a save duration phase, gym_parked. The other three are sibling counts, beside the reused and rerun siblings a restore already reports: continued, restarted and gym_restarted. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's Lens export (#4730) sends each rollout save and restore metric through a fixed mapping, and a drift test fails when the controller logs a key the mapping does not name. Turn-level recovery logs four such keys: how long Gym held rollout dispatch for a save, the episodes that save could not capture, and the siblings a restore continued or restarted. gym_parked_seconds becomes a save duration phase, gym_parked. The other three are sibling counts, beside the reused and rerun siblings a restore already reports: continued, restarted and gym_restarted. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's Lens export (#4730) sends each rollout save and restore metric through a fixed mapping, and a drift test fails when the controller logs a key the mapping does not name. Turn-level recovery logs four such keys: how long Gym held rollout dispatch for a save, the episodes that save could not capture, and the siblings a restore continued or restarted. gym_parked_seconds becomes a save duration phase, gym_parked. The other three are sibling counts, beside the reused and rerun siblings a restore already reports: continued, restarted and gym_restarted. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's Lens export (#4730) sends each rollout save and restore metric through a fixed mapping, and a drift test fails when the controller logs a key the mapping does not name. Turn-level recovery logs four such keys: how long Gym held rollout dispatch for a save, the episodes that save could not capture, and the siblings a restore continued or restarted. gym_parked_seconds becomes a save duration phase, gym_parked. The other three are sibling counts, beside the reused and rerun siblings a restore already reports: continued, restarted and gym_restarted. Signed-off-by: Anish Mahishi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
What does this PR do ?
Export the rollout checkpoint measurements that Single Controller already logs to NeMo Lens / OpenTelemetry: completed save/restore phases and volumes, every periodic snapshot attempt (including skipped and failed ones), and one trace-only span per completed save.
Metrics. The logger tee recognizes
timing/rollout_checkpointandtiming/rollout_recovery, records phase durations inrl.checkpoint.duration, and publishes snapshot row/group counts, reused/rerun sibling counts, and controller-sidecar bytes. It uses fixed operation/phase/category labels (declared asRL_CHECKPOINT_*constants), rejects invalid measurements, and adds no checkpoint or rollout IDs to metric labels. These metrics carry no goodput bucket: save phases nest insidetotal, so they must not be summed. Restore phases are disjoint andtotal_load_secondskeeps its existing meaning (their sum, excludingredispatch_schedule), not allocation-to-ready time.Snapshot attempts. Completed saves alone cannot tell "snapshots never complete" apart from "telemetry is off". The tee also reads the controller's per-attempt
rollout/checkpoint_outcomedict and exportsrl.checkpoint.attempts(counter, labelledrl.checkpoint.outcomeandrl.checkpoint.reason),rl.checkpoint.attempt_duration(histogram, by outcome), andrl.checkpoint.seconds_since_last_success(gauge;0on success, absent before the first one). Outcome and reason are decoded from the controller's one-hot flags and are fixed sets (3 outcomes, 8 reasons); an attempt that does not set exactly one of each is not counted. Skips are expected (a snapshot is only valid while the trainer is at a durable checkpoint step, so attempts after the next optimizer commit skip withmissing_trainer_anchor); a climbingoutcome=skippedwithcompletedat zero is the signal that snapshots are not completing. The label lists are copied fromrollout_checkpoint.py, which imports the GRPO stack, and a source-drift test keeps them equal.Span. Each completed save also emits
rl.sc.rollout_checkpoint.save, rebuilt from the logged timings rather than opened around the save, so the checkpoint path is untouched. It ends attelemetry/wall_time_seconds, startstotal_save_secondsearlier, and carries the phase durations, volume counts,rl.checkpoint.snapshot_sequenceandrl.iterationas attributes, so a slow save can be tied to its snapshot. It is gated by thecheckpointspan group (in thedefaultpreset) but carries norl.bucket: the snapshot pump runs beside training, so an overhead bucket would double-count wall clock in goodput. Phases are attributes, not child spans, because only their durations are logged.rl.iterationis set explicitly, as main'scheckpoint_finalize_spandoes, so it names the step the snapshot is anchored to rather than whatever step is running when the pump fires. Likerl.checkpoint.finalize, the span is unbucketed because it overlaps training. Restore emits no span, since its phases run at different times in driver setup and in the controller. The span is emitted before metric registration, so a registry failure cannot suppress it.TELEMETRY_WALL_TIME_METRICmoves tonemo_rl.telemetry.metrics(the tee reads it and must not import the logger);nemo_rl.utils.loggerre-exports it, so existing imports are unchanged.This PR does not change checkpoint execution or add runtime thread/event-loop instrumentation. The latter is reviewed independently in #4732. Both PRs target main and can land independently.
Issues
No separate issue; expose existing rollout checkpoint measurements through the existing Lens integration.
Usage
Enable telemetry and metric export using the existing configuration:
Configure the normal Lens/OTLP destination for the run. Read
rl.checkpoint.durationby operation and phase, and userl.checkpoint.rows,rl.checkpoint.groups,rl.checkpoint.siblings, andrl.checkpoint.sidecar_bytesfor captured/restored volume. Watchrl.checkpoint.attemptsby outcome and reason to see whether periodic snapshots are completing, andrl.checkpoint.seconds_since_last_successfor how stale the newest one is. To find which save was slow, filter traces onrl.sc.rollout_checkpoint.save. These report finished operations and attempts; they are not an in-progress hang watchdog.Validation
tests/unit/telemetryon Python 3.13.14: 254 passed.tests/unit/utils/test_logger.py: 106 passed (covers theTELEMETRY_WALL_TIME_METRICre-export). Run against main's pinned nemo-lens (4d045c0); the local container's older lens lacksspan_attributes, which main now imports.train_step/ wall time), prefix isolation, no-op when not exporting for all three prefixes; save span timing, attributes, absence ofrl.bucket, span-group gating, parenting to the current span, survival of a failed metric registration, and no span on restore; attempt outcomes counted by outcome/reason, staleness absent before the first success and0on success, malformed attempt dicts not counted.test_source_drift.pyfollows everytiming/rollout_*dict acrosssingle_controller.pyandsetup.py(including the restore dict carried from setup to the controller). Mutation-checked: an added unmapped restore key and a removed mapped key each fail it. A second drift test keeps the tee's attempt outcome/reason labels equal to the controller'sLiteraltypes (mutation-checked with an added reason). The span-docs drift guard now also covers spans emitted bynemo_rl/telemetry/metrics.py.metrics.py: 0 errors. Ruff lint/format clean on changed files.Before your PR is "Ready for review"
metrics.md,span-groups.md).