nemo_gym.telemetry.gym_metrics
nemo_gym.telemetry.gym_metrics
Attributed OTel instruments that nemo.lens.instruments.gym.record_gym_metrics cannot express.
nemo_gym.telemetry.metrics forwards to the five fixed, undimensioned instruments nemo-lens
declares. Anything that needs an attribute (a provider, a site, a class) is created here,
directly on the lens meter, and cached per meter so a re-initialised telemetry handle gets
fresh instruments. Every recorder is a no-op unless telemetry is initialised and exporting,
and never raises into its caller. Call sites use the relevant span-group or metrics-export gate
so disabled telemetry stays off the hot path.
Sandbox lifecycle
gym.sandbox.active (up-down counter): sandboxes this process currently holds, +1 when a
provider hands back a handle, -1 when Gym releases it. Summed by the backend across the
processes that hold sandboxes; a gauge would show whichever process wrote last.
gym.sandbox.startup_duration_ms / gym.sandbox.exec_duration_ms (histograms): wall-clock
of one provisioning and one command. Explicit bucket boundaries up to thirty minutes: the SDK
default stops at ten seconds and a sandbox start routinely takes a minute.
gym.sandbox.create_retry_total (counter): one per create attempt a provider retried.
Retrying is provider-internal, so each provider that retries records it from its own loop.
All four carry nemo.gym.sandbox.provider.
HTTP connection pool
gym.http.connection_pool.queue_duration_ms (histogram): connection-acquisition wait
for one queued connection acquisition, combining repeated waiter wakeups within it.
Queued redirect hops, aiohttp reconnects, and Gym retries each record separate samples.
Connection attempts that acquire a slot immediately do not record a queue-duration histogram sample.
Bounded attributes identify the binding connector limit, queue outcome, and destination server.
gym.http.connection_pool.connect_total (observable counter): all connection attempts
(connect() calls), including attempts that later fail or are abandoned.
Compare its value with the queue-duration histogram count to calculate the queued fraction.
Module Contents
Functions
Data
HTTP_CONNECTION_POOL_CONNECT_INSTRUMENT
HTTP_CONNECTION_POOL_QUEUE_CONSTRAINT_ATTRIBUTE
HTTP_CONNECTION_POOL_QUEUE_DURATION_BOUNDARIES_MS
HTTP_CONNECTION_POOL_QUEUE_DURATION_INSTRUMENT
HTTP_CONNECTION_POOL_QUEUE_OUTCOME_ATTRIBUTE
HTTP_DESTINATION_SERVER_NAME_ATTRIBUTE
SANDBOX_CREATE_RETRY_INSTRUMENT
SANDBOX_DURATION_BOUNDARIES_MS
API
Drop cached instruments. Test-only.
Record one queued connection acquisition.
Add delta (+1 on start, -1 on stop) to gym.sandbox.active for provider.
Count one retried sandbox-create attempt, by provider.
Record one command’s wall-clock inside an already-provisioned sandbox, by provider.
Record one sandbox’s provisioning wall-clock, by provider.
Export cumulative connection-attempt counts without an OTel call on each connect.