Configuration
CLI flags
These flags are processed in megatron/training/global_vars.py:_set_telemetry() and override the corresponding env vars.
Megatron-specific environment variables
Each MEGATRON_OTEL_* variable is an alias for the corresponding NemoLensConfig field with NEMO_LENS_* as fallback — they are not independent settings. Setting MEGATRON_OTEL_ENABLED=1 is equivalent to setting NEMO_LENS_ENABLED=1; they refer to the same underlying config. The prefix/fallback model lets Megatron scope its own env vars while still inheriting lens defaults from a shared environment.
For the full config model, field semantics, and validation rules, see lens: configuration.
Rank strategy
Controls which ranks actually send telemetry. Four strategies are available: single_rank (default), all_ranks, sampled, and first_rank_per_node, configured via MEGATRON_OTEL_RANK_STRATEGY above.
See lens: sampling for detailed semantics, when to use each, and how they compose with OTel SDK samplers.
Standard OTel SDK variables
All standard OTel SDK env vars are honoured by the SDK directly:
Run Identification
Each training run is automatically assigned a unique nemo.run.id resource attribute that flows to all backends.
Priority order:
NEMO_LENS_RUN_IDenv var (explicit, highest priority)SLURM_JOB_IDenv var (auto-detected on SLURM clusters)- Auto-generated 12-character UUID (fallback)
All ranks in a distributed job share the same run_id. Each rank gets a unique service.instance.id of {run_id}-rank{rank}.
Filter by nemo.run.id in Jaeger, Grafana, Kibana to isolate a specific run.
Resource attributes
Megatron’s _set_telemetry() sets training-config attributes on the OTel Resource so they appear as Jaeger “Process” tags across every span in the run:
Plus auto-detected attributes from lens’s resource detection: hostname, PID, GPU count, SLURM metadata, Kubernetes metadata.
Typical configurations
Local development with console exporter
Spans and metrics print to stdout.
Local collector
Point Megatron at an OTLP endpoint on localhost — an OpenTelemetry Collector, or a backend such as Jaeger that accepts OTLP directly:
For a local stack to send this to, see lens: sending telemetry to a backend.