Skip to content

Commit 07be965

Browse files
authored
Merge pull request #2264 from anik120/fix-otel-instrumentation
LCORE-1801: Fix Otel intrumentation to respect OTEL_SDK_DISABLED flag
2 parents 41787d9 + 2b10deb commit 07be965

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ CONTAINER_RUNTIME ?= $(shell command -v podman 2>/dev/null || command -v docker
3636
docs/models/database.svg
3737

3838
run-stack: ## Run lightspeed-stack directly, without building dependent service/s
39-
uv run opentelemetry-instrument python3.12 src/lightspeed_stack.py -c $(CONFIG)
39+
@if [ "$${OTEL_SDK_DISABLED:-true}" = "false" ]; then \
40+
uv run opentelemetry-instrument python3.12 src/lightspeed_stack.py -c $(CONFIG); \
41+
else \
42+
uv run python3.12 src/lightspeed_stack.py -c $(CONFIG); \
43+
fi
4044

4145
run: start-llama-stack-container ## Run the service locally with dependent services
4246
@echo "Starting Lightspeed Core Stack..."

deploy/lightspeed-stack/Containerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,13 @@ ENV PATH="/app-root/.venv/bin:$PATH"
133133
# We place them at /app-root/providers.d. YAMLs there reference lightspeed_stack_providers.*, so that package must be on PYTHONPATH.
134134
ENV PYTHONPATH="/app-root"
135135

136+
# Copy entrypoint script
137+
COPY ${LSC_SOURCE_DIR}/scripts/entrypoint.sh /app-root/entrypoint.sh
138+
RUN chmod +x /app-root/entrypoint.sh
139+
136140
# Run the application
137141
EXPOSE 8080
138-
ENTRYPOINT ["opentelemetry-instrument", "python3.12", "src/lightspeed_stack.py"]
142+
ENTRYPOINT ["/app-root/entrypoint.sh"]
139143

140144
LABEL vendor="Red Hat, Inc." \
141145
name="lightspeed-core/lightspeed-stack-rhel9" \

scripts/entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Only use OpenTelemetry instrumentation if explicitly enabled
5+
# Use explicit venv paths to ensure dependencies are found
6+
if [ "${OTEL_SDK_DISABLED:-true}" = "false" ]; then
7+
exec /app-root/.venv/bin/opentelemetry-instrument /app-root/.venv/bin/python src/lightspeed_stack.py "$@"
8+
else
9+
exec /app-root/.venv/bin/python src/lightspeed_stack.py "$@"
10+
fi

tests/e2e-prow/rhoai/manifests/lightspeed/lightspeed-stack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ spec:
6363
key: key
6464
optional: true
6565
image: ${LIGHTSPEED_STACK_IMAGE}
66-
command: ["/bin/sh", "-c", "mkdir -p /tmp/data && exec opentelemetry-instrument python3.12 src/lightspeed_stack.py"]
66+
command: ["/bin/sh", "-c", "mkdir -p /tmp/data && exec /app-root/entrypoint.sh"]
6767
ports:
6868
- containerPort: 8080
6969
# TCP probes avoid HTTP/auth. LCS + Llama handshake and large images can take 60–120s before :8080 listens;

0 commit comments

Comments
 (0)