Observability Overview
Megatron-LM is instrumented with OpenTelemetry via the nemo-lens library, emitting traces at training-framework boundaries and metrics for loss, throughput, and gradient norm.
Telemetry exports to any OTLP-compatible backend (Jaeger, Grafana Tempo, W&B Weave, Honeycomb, Datadog, …).
What’s in this section
Scope
This documentation covers Megatron-specific usage: CLI flags, environment variables, span names, metric names, and the pipeline-parallel trace correlation integration.
For general concepts — span groups, instrumentation primitives, configuration model, custom exporters, resource detection — see the lens documentation. This section links to lens docs when relevant rather than duplicating content.
Quick start
With default span groups, Megatron emits a handful of coarse spans per iteration and a steady stream of training metrics. Switch to per_step for profiling individual steps, or all for fine-grained debugging.
What gets instrumented
Each span is tagged with a span group that controls whether it’s emitted at runtime. See Span Groups.
What gets exported
- Traces: Jaeger / Tempo / Honeycomb / etc. via OTLP.
- Metrics: Prometheus via the OTel Collector, or direct OTLP to Grafana Mimir / Datadog / etc.
- Logs (optional): via the OTel log bridge when
MEGATRON_OTEL_LOGS_ENABLED=1— correlatesloggingrecords with the active span’s trace ID.
By default, only one rank exports (the last rank). For multi-rank telemetry, see Configuration — Rank strategy.
Related
- Lens configuration model and env vars: lens: configuration
- Instrumentation primitives (
managed_span,trace_fn,span_cm): lens: instrumentation - Sending telemetry to a backend: lens: backends