llama-stack-mirror/containers
Adrian Cole 3325f59c7b feat: Add opt-in OpenTelemetry auto-instrumentation to Docker images
Builds on #4127 by adding OpenTelemetry auto-instrumentation support to Docker images. After #4127 migrated to automatic instrumentation, the Docker images lacked the necessary dependencies. This PR installs the OTEL packages and enables instrumentation when any OTEL_* environment variable is set.

Test Plan:

Build image:
docker build -f containers/Containerfile   --build-arg DISTRO_NAME=starter   --build-arg INSTALL_MODE=editable   --tag llamastack/distribution-starter:otel-test .

Run with trace propagation enabled (parentbased_traceidratio with 0.0 prevents new traces but allows propagation of incoming traces):
docker run -p 8321:8321   -e OTEL_EXPORTER_OTLP_ENDPOINT=http://host.docker.internal:4318   -e OTEL_SERVICE_NAME=llama-stack   -e OTEL_TRACES_SAMPLER=parentbased_traceidratio   -e OTEL_TRACES_SAMPLER_ARG=0.0   llamastack/distribution-starter:otel-test

Ran a sample flight search agent. Traces successfully captured.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2025-12-03 05:51:12 +08:00
..
Containerfile feat: Add opt-in OpenTelemetry auto-instrumentation to Docker images 2025-12-03 05:51:12 +08:00