From ef885d214767b58580d3e711971e5a8b4f448aea Mon Sep 17 00:00:00 2001 From: Jose Angel Morena Simon <38217290+jangel97@users.noreply.github.com> Date: Thu, 5 Jun 2025 09:34:46 +0200 Subject: [PATCH] fix(server): Add missing OpenTelemetry dependencies to resolve telemetry import errors (#2391) This PR fixes a runtime import error caused by missing OpenTelemetry dependencies during `llama stack run`. Specifically, the following imports fail if `opentelemetry-sdk` and `opentelemetry-exporter-otlp-proto-http` are not present in the environment: ```python from opentelemetry import metrics, trace from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter ``` See [llama\_stack/providers/inline/telemetry/meta\_reference/telemetry.py#L10-L19](https://github.com/meta-llama/llama-stack/blob/main/llama_stack/providers/inline/telemetry/meta_reference/telemetry.py#L10-L19) This PR resolves the issue by adding both packages to the `SERVER_DEPENDENCIES` list: ```python "opentelemetry-sdk", "opentelemetry-exporter-otlp-proto-http", ``` ### Reproduction Steps ```bash llama stack build --config llama.yaml --image-type venv --image-name fun-with-lamas llama stack run ~/.llama/distributions/fun-with-lamas/fun-with-lamas-run.yaml ``` Results in: ``` ModuleNotFoundError: No module named 'opentelemetry' ``` or ``` ModuleNotFoundError: No module named 'opentelemetry.exporter' ``` Signed-off-by: Jose Angel Morena Co-authored-by: raghotham --- llama_stack/distribution/build.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llama_stack/distribution/build.py b/llama_stack/distribution/build.py index 072f9c425..5906614ed 100644 --- a/llama_stack/distribution/build.py +++ b/llama_stack/distribution/build.py @@ -29,6 +29,8 @@ SERVER_DEPENDENCIES = [ "fire", "httpx", "uvicorn", + "opentelemetry-sdk", + "opentelemetry-exporter-otlp-proto-http", ]