Skip to navigation

nemo_gym.rollouts.tool_telemetry

View as MarkdownOpen in Claude

Tool spans and metrics derived from a finished rollout’s v2 trajectory record.

Nothing is measured again: each tool execution the harness recorded becomes a gym.tool span under the rollout’s dispatch span, and a count and duration in the tool metrics. A span needs both recorded endpoints and a duration needs a recorded duration; a missing one is left out, never written as zero.

Module Contents

Functions

NameDescription
_emit_tool_spans-
_span_timing-
_tool_calls-
record_tool_telemetryCount a finished rollout’s tool executions and, under its dispatch span, emit one span each.

Data

TOOL_SPAN_NAME

_SPAN_BOUNDARY_ORDER

logger

API

nemo_gym.rollouts.tool_telemetry._emit_tool_spans(
dispatch_span_context: opentelemetry.trace.SpanContext
) -> None
nemo_gym.rollouts.tool_telemetry._span_timing(
nemo_gym.rollouts.tool_telemetry._tool_calls(
result: typing.Mapping[str, typing.Any]
nemo_gym.rollouts.tool_telemetry.record_tool_telemetry(
result: typing.Mapping[str, typing.Any],
dispatch_span_context: typing.Optional[opentelemetry.trace.SpanContext]
) -> None

Count a finished rollout’s tool executions and, under its dispatch span, emit one span each.

A tool whose recorded parent is another tool goes under that tool’s span; parents are emitted first, and the record guarantees there are no cycles. Never raises: telemetry must not fail a rollout.

nemo_gym.rollouts.tool_telemetry.TOOL_SPAN_NAME = 'gym.tool'
nemo_gym.rollouts.tool_telemetry._SPAN_BOUNDARY_ORDER = ('executor', 'lifecycle', 'transcript', 'event_receipt')
nemo_gym.rollouts.tool_telemetry.logger = logging.getLogger(__name__)