Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

[Fix]: Fix extraction of GPU name and UUID in OTel instrumentation (#489)

Patcherabd23212e32b
diff --git a/otel-gpu-collector/dockerfile b/otel-gpu-collector/dockerfile
index bc5c44ad..8af267f6 100644
--- a/otel-gpu-collector/dockerfile
+++ b/otel-gpu-collector/dockerfile
@@ -17,7 +17,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY . .
# Install necessary Python packages
-RUN pip install --no-cache-dir --no-binary :psutil: psutil openlit
+RUN pip install --no-cache-dir --no-binary :psutil: psutil==6.1.0 nvidia-ml-py==12.560.30 amdsmi==6.2.4 openlit
# Expose any required ports, if necessary
EXPOSE 80
diff --git a/sdk/python/pyproject.toml b/sdk/python/pyproject.toml
index 0684df96..d2c2aceb 100644
--- a/sdk/python/pyproject.toml
+++ b/sdk/python/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "openlit"
-version = "1.28.0"
+version = "1.29.0"
description = "OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications and GPUs, facilitating the integration of observability into your GenAI-driven projects"
authors = ["OpenLIT"]
repository = "https://github.com/openlit/openlit/tree/main/openlit/python"
diff --git a/sdk/python/src/openlit/instrumentation/gpu/__init__.py b/sdk/python/src/openlit/instrumentation/gpu/__init__.py
index aa133474..1d20f8f9 100644
--- a/sdk/python/src/openlit/instrumentation/gpu/__init__.py
+++ b/sdk/python/src/openlit/instrumentation/gpu/__init__.py
@@ -132,13 +132,18 @@ class GPUInstrumentor(BaseInstrumentor):
gpu_index, e)
return 0
+ def safe_decode(byte_string):
+ if isinstance(byte_string, bytes):
+ return byte_string.decode('utf-8')
+ return byte_string
+
attributes = {
TELEMETRY_SDK_NAME: "openlit",
SemanticConvetion.GEN_AI_APPLICATION_NAME: application_name,
SemanticConvetion.GEN_AI_ENVIRONMENT: environment,
SemanticConvetion.GPU_INDEX: str(gpu_index),
- SemanticConvetion.GPU_UUID: pynvml.nvmlDeviceGetUUID(handle).decode('utf-8'),
- SemanticConvetion.GPU_NAME: pynvml.nvmlDeviceGetName(handle).decode('utf-8')
+ SemanticConvetion.GPU_UUID: safe_decode(pynvml.nvmlDeviceGetUUID(handle)),
+ SemanticConvetion.GPU_NAME: safe_decode(pynvml.nvmlDeviceGetName(handle))
}
yield Observation(get_metric_value(handle, metric_name), attributes)