OpenTelemetry¶
Nomad emits OpenTelemetry metrics and spans for model serving and the code-mode gateway when telemetry export is enabled. Install the optional dependency extra to include the OTel SDK and OTLP/gRPC exporter:
pip install "nomad[otel]"
Enabling export¶
Nomad configures OTLP/gRPC trace and metric exporters when any of these are set:
telemetry.enabled: trueinnomad.config.ServerConfigornomad.gateway.config.GatewayConfig.NOMAD_OTEL_ENABLED=true.Standard OTel environment variables such as
OTEL_EXPORTER_OTLP_ENDPOINT,OTEL_EXPORTER_OTLP_TRACES_ENDPOINT,OTEL_EXPORTER_OTLP_METRICS_ENDPOINT,OTEL_TRACES_EXPORTER, orOTEL_METRICS_EXPORTER.
Set telemetry.service_name or OTEL_SERVICE_NAME to control the exported
service name. Set telemetry.otlp_endpoint or OTEL_EXPORTER_OTLP_ENDPOINT to
control the collector endpoint. Set OTEL_SDK_DISABLED=true to disable SDK
setup.
For OTel environment variable behavior and exporter configuration, see the OpenTelemetry Python documentation and Python exporter documentation.
Spans¶
nomad serve creates spans around managed Torch tool requests and batch
execution. The code-mode gateway creates spans for MCP tool entrypoints, sandbox
runs, and upstream MCP tool calls.
Model-serving metrics¶
The table is generated from src/nomad/metrics.py.
Metric |
Type |
Unit |
Description |
|---|---|---|---|
|
counter |
|
Tool requests accepted by the Torch tool manager. |
|
counter |
|
Tool requests completed with an execution error. |
|
counter |
|
Tool requests cancelled while pending or executing. |
|
counter |
|
Tool requests rejected before enqueueing. |
|
histogram |
|
End-to-end tool request duration, including queue wait. |
|
histogram |
|
Time a tool request waits before batch execution starts. |
|
histogram |
|
Wall time spent executing one model batch. |
|
histogram |
|
Number of requests included in an executed model batch. |
|
counter |
|
Batch size reductions caused by out-of-memory errors. |
|
histogram |
|
Time spent moving a tool onto a device. |
|
counter |
|
Tool offload operations to CPU. |
|
counter |
|
Device allocations removed after a tool idle timeout. |
|
counter |
|
Tool load attempts from a registered source. |
|
histogram |
|
Wall time spent loading a tool from a registered source. |
|
counter |
|
Resident CPU tool instances unloaded after a disk idle timeout. |
|
counter |
|
Accelerator cache clear attempts after server idle periods. |
|
histogram |
|
Wall time spent clearing unused accelerator cache. |
|
observable up/down counter |
|
Pending requests per managed tool. |
|
observable up/down counter |
|
Requests currently assigned to executing batches. |
|
observable up/down counter |
|
Current effective batch size per managed tool. |
|
observable up/down counter |
|
Number of tools waiting for scheduler dispatch. |
|
observable gauge |
|
Whether a managed device slot is busy. |
|
observable up/down counter |
|
Whether a tool is resident on a managed device slot. |
|
observable up/down counter |
|
Whether a managed tool has a resident CPU instance. |
|
observable gauge |
|
Best-effort accelerator memory currently allocated. |
|
observable gauge |
|
Best-effort accelerator memory currently reserved by the backend. |
|
observable gauge |
|
Backend-reported device utilization ratio when available. |
Gateway metrics¶
The gateway metrics cover MCP entrypoints, sandbox execution, and upstream MCP tool calls.
Metric |
Type |
Unit |
Description |
|---|---|---|---|
|
counter |
|
Code-mode gateway requests received. |
|
histogram |
|
Code-mode gateway request duration. |
|
histogram |
|
Sandbox subprocess execution duration. |
|
counter |
|
Upstream MCP tool calls made through the code-mode gateway. |
|
histogram |
|
Duration of upstream MCP tool calls made through the gateway. |