Appearance
Using the SDK
Connect to ARMS
Ensure ARMS is running. Send telemetry to https://<arms-host>/api/ingest with an x-api-key header — not collector port 4318. For on-prem access, see On-prem ARMS.
Install ARMS
Open your command line or terminal and run:
shell
pip install --extra-index-url https://arms-packages.elsaifoundry.ai/root/elsai-arms/ elsai-arms==3.0.3Initialize ARMS in your Application
TIP
Not sure which method to choose? Check out Instrumentation Methods to understand the differences.
Zero-code instrumentation
Via CLI arguments
bash
# Start GPU monitoring instantly
elsai-arms-instrument --collect-system-metrics python your_app.py
# With custom settings
elsai-arms-instrument \
--otlp-endpoint http://127.0.0.1:4318 \
--service-name my-gpu-app \
--environment production \
--collect-system-metrics \
python your_app.pyVia Environment Variables
Set environment variables:
bash
export OTEL_EXPORTER_OTLP_ENDPOINT="http://127.0.0.1:4318"
export ELSAI_ARMS_COLLECT_SYSTEM_METRICS=true
export OTEL_SERVICE_NAME=my-gpu-app
# Run your application
elsai-arms-instrument python your_app.pyManual instrumentation
You can set up ARMS in your application using either function arguments directly in your code or by using environment variables.
Parameters
Add the following two lines to your application code:
python
import elsai_arms
elsai_arms.init(
otlp_endpoint="http:127.0.0.1:4318",
collect_system_metrics=True # This enables GPU monitoring
)Replace:
YOUR_OTEL_ENDPOINTwith your OpenTelemetry backend. For ARMS, usehttps://<arms-host>/api/ingestplus anx-api-keyheader — not collector port4318. For a generic OTel Collector, usehttp://127.0.0.1:4318.
Note: collect_system_metrics=True replaces the deprecated collect_gpu_stats=True
Environment Variables
Configure your OTLP endpoint using environment variables:
shell
export OTEL_EXPORTER_OTLP_ENDPOINT=""http://127.0.0.1:4318"
export ELSAI_ARMS_COLLECT_SYSTEM_METRICS=trueAdd the following two lines to your application code:
python
import elsai_arms
elsai_arms.init(collect_system_metrics=True)Replace:
YOUR_OTEL_ENDPOINTwith your OpenTelemetry backend. For ARMS, usehttps://<arms-host>/api/ingestplus anx-api-keyheader — not collector port4318. For a generic OTel Collector, usehttp://127.0.0.1:4318.
To send metrics to other Observability tools, refer to the supported destinations.
For more advanced configurations and application use cases, visit the ARMS Python repository.
Using the Collector
Connect to ARMS
Ensure ARMS is running. Send telemetry to https://<arms-host>/api/ingest with an x-api-key header — not collector port 4318. For on-prem access, see On-prem ARMS.
Pull otel-gpu-collector Docker Image
You can quickly start using the OTel GPU Collector by pulling the Docker image:
sh
docker pull <gpu-collector-image>Run otel-gpu-collector Docker container
You can quickly start using the OTel GPU Collector by pulling the Docker image: Here's a quick example showing how to run the container with the required environment variables:
sh
docker run --gpus all --pid=host \
-e OTEL_SERVICE_NAME='chatbot' \
-e OTEL_RESOURCE_ATTRIBUTES='deployment.environment=staging' \
-e OTEL_EXPORTER_OTLP_ENDPOINT="http://127.0.0.1:4318" \
<gpu-collector-image>--pid=host is required for per-process GPU attribution (cmdline, PID, zombie state).
For more advanced configurations of the collector, visit the OTel GPU Collector repository.
Note: If ARMS and the collector run on the same Docker network, use the ARMS service hostname; otherwise use the host IP. You can also add the OTel GPU Collector under services in your own Compose file:
Docker Compose: Add the following config under services
yaml
otel-gpu-collector:
image: <gpu-collector-image>
pid: host
environment:
OTEL_SERVICE_NAME: 'chatbot'
OTEL_RESOURCE_ATTRIBUTES: 'deployment.environment=staging'
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector:4318"
device_requests:
- driver: nvidia
count: all
capabilities: [gpu]
depends_on:
- otel-collector
restart: alwaysHost IP: Use the Host IP to connect to OTel Collector
sh
OTEL_EXPORTER_OTLP_ENDPOINT="http://192.168.10.15:4318"