GPU Performance Monitoring
Get started
Collect and send GPU performance metrics directly from your application to an OpenTelemetry endpoint.
OpenTelemetry GPU CollectorInstall the OpenTelemetry GPU Collector as a Docker container to collect and send GPU performance metrics to an OpenTelemetry endpoint.
Using the SDK
git clone git@github.com:ThinkfleetAI/Shield360.gitFrom the root directory of the Shield360 distribution, Run the below command:
docker compose up -dOpen your command line or terminal and run:
pip install shield360# Start GPU monitoring instantlyshield360-instrument --collect-system-metrics python your_app.py
# With custom settingsshield360-instrument \ --otlp-endpoint http://127.0.0.1:4318 \ --service-name my-gpu-app \ --environment production \ --collect-system-metrics \ python your_app.pySet environment variables:
export OTEL_EXPORTER_OTLP_ENDPOINT="http://127.0.0.1:4318"export SHIELD360_COLLECT_SYSTEM_METRICS=trueexport OTEL_SERVICE_NAME=my-gpu-app
# Run your applicationshield360-instrument python your_app.pyYou can set up Shield360 in your application using either function arguments directly in your code or by using environment variables.
Add the following two lines to your application code:
import shield360
shield360.init( otlp_endpoint="http:127.0.0.1:4318", collect_system_metrics=True # This enables GPU monitoring)Replace:
YOUR_OTEL_ENDPOINTwith the URL of your OpenTelemetry backend, such ashttp://127.0.0.1:4318if you are using Shield360 and a local OTel Collector.
Note: collect_system_metrics=True replaces the deprecated collect_gpu_stats=True
Configure your OTLP endpoint using environment variables:
export OTEL_EXPORTER_OTLP_ENDPOINT=""http://127.0.0.1:4318"export SHIELD360_COLLECT_SYSTEM_METRICS=trueAdd the following two lines to your application code:
import shield360
shield360.init(collect_system_metrics=True)Replace:
YOUR_OTEL_ENDPOINTwith the URL of your OpenTelemetry backend, such ashttp://127.0.0.1:4318if you are using Shield360 and a local OTel Collector.
To send metrics to other Observability tools, refer to the supported destinations.
For more advanced configurations and application use cases, visit the SDK configuration reference.
Using the Collector
git clone git@github.com:ThinkfleetAI/Shield360.gitFrom the root directory of the Shield360 distribution, Run the below command:
docker compose up -dYou 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="http://127.0.0.1:4318" \ 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"