Monitor NVIDIA GPUs using OpenTelemetry
Shield360 uses OpenTelemetry to help you monitor NVIDIA GPUs. This includes tracking GPU metrics like utilization, temperature, memory usage and power consumption.
Get started
Section titled “Get started”Collect and send GPU performance metrics directly from your application to an OpenTelemetry endpoint.
Using the CollectorInstall the OpenTelemetry GPU Collector as a Docker container to collect and send GPU performance metrics to an OpenTelemetry endpoint.
Using the SDK
Open your command line or terminal and run:
pip install shield360Perfect for existing applications - no code modifications needed:
# Configure via CLI argumentsshield360-instrument \ --service-name my-ai-app \ --environment production \ --otlp-endpoint YOUR_OTEL_ENDPOINT \ python your_app.py# Configure via environment variablesexport OTEL_SERVICE_NAME=my-ai-appexport OTEL_DEPLOYMENT_ENVIRONMENT=productionexport OTEL_EXPORTER_OTLP_ENDPOINT=YOUR_OTEL_ENDPOINT
# Run with zero code changesshield360-instrument python your_app.pyimport shield360
shield360.init(otlp_endpoint="YOUR_OTEL_ENDPOINT")Add the following two lines to your application code:
import shield360
shield360.init()Then, configure the your OTLP endpoint using environment variable:
export OTEL_EXPORTER_OTLP_ENDPOINT=YOUR_OTEL_ENDPOINTimport shield360 from "shield360"
shield360.init({ otlpEndpoint: "YOUR_OTEL_ENDPOINT" })Add the following two lines to your application code:
import shield360 from "shield360"
shield360.init()Then, configure the your OTLP endpoint using environment variable:
export OTEL_EXPORTER_OTLP_ENDPOINT=YOUR_OTEL_ENDPOINTReplace: YOUR_OTEL_ENDPOINT with the URL of your OpenTelemetry backend, such as http://127.0.0.1:4318 if you are using Shield360 and a local OTel Collector.
To send metrics and traces to other Observability tools, refer to the supported destinations.
For more advanced configurations and application use cases, visit the SDK configuration reference or TypeScript SDK reference.
Using the Collector
You can quickly start using the OTel GPU Collector by pulling the Docker image:
docker pull ghcr.io/thinkfleetai/otel-gpu-collector:latestYou 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:
docker run --gpus all --pid=host \ -e OTEL_SERVICE_NAME='chatbot' \ -e OTEL_RESOURCE_ATTRIBUTES='deployment.environment=staging' \ -e OTEL_EXPORTER_OTLP_ENDPOINT="YOUR_OTEL_ENDPOINT" \ -e OTEL_EXPORTER_OTLP_HEADERS="YOUR_OTEL_HEADERS" \ ghcr.io/thinkfleetai/otel-gpu-collector:latest--pid=host is required for per-process GPU attribution (cmdline, PID, zombie state).
For more advanced configurations of the collector, visit the GPU Collector documentation.
Note: If you’ve deployed Shield360 using Docker Compose (docker-compose.yml in the Shield360 distribution), make sure to use the host’s IP address or add OTel GPU Collector to the Docker Compose (docker-compose.yml in the Shield360 distribution):
Docker Compose: Add the following config under `services`
otel-gpu-collector: image: ghcr.io/thinkfleetai/otel-gpu-collector:latest 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
OTEL_EXPORTER_OTLP_ENDPOINT="http://192.168.10.15:4318"Environment Variables
Section titled “Environment Variables”OTel GPU Collector uses standard OpenTelemetry environment variables for configuration:
| Environment Variable | Description | Default Value |
|---|---|---|
OTEL_SERVICE_NAME | Service/application name attached to all metrics | default |
OTEL_RESOURCE_ATTRIBUTES | Resource attributes, e.g. deployment.environment=production | deployment.environment=default |
OTEL_EXPORTER_OTLP_ENDPOINT | OpenTelemetry OTLP endpoint URL | (required) |
OTEL_EXPORTER_OTLP_HEADERS | Headers for authenticating with the OTLP endpoint | Ignore if using Shield360 |
OTEL_METRIC_EXPORT_INTERVAL | Metric polling interval in milliseconds | 10000 |
Details on the types of metrics collected and their descriptions.