Skip to content

Commit dd8ef2b

Browse files
cdoernclaude
andauthored
fix(containers): tolerate OTel bootstrap conflicts when backfilling old releases (#6063)
## What Adds an `OTEL_BEST_EFFORT` build arg. When set to `1`, a failure of `opentelemetry-bootstrap -a install` is logged and tolerated instead of failing the image build. The base `opentelemetry-distro`/`opentelemetry-exporter-otlp` install remains required either way. The publish workflow sets `OTEL_BEST_EFFORT=1` **only** when bundling a non-`ogx` package (a pre-rename backfill, e.g. `llama-stack`). `ogx` release images keep the strict behavior. ## Why `opentelemetry-bootstrap -a install` auto-selects the *latest* per-library instrumentation packages. When backfilling an older release, those conflict with the release's pinned deps and the build fails: ``` RuntimeError: Dependency conflict found: opentelemetry-instrumentation-openai-v2 2.4b0 requires opentelemetry-util-genai>=0.4b0.dev, but you have opentelemetry-util-genai 0.2b0 ERROR: ... "opentelemetry-bootstrap -a install" ... exit code: 1 ``` Hit while backfilling `llama-stack` 0.5.2 images. The per-library bootstrap is inherently best-effort; the core OTel exporter/distro (the part needed for OTLP export) still installs. ## Effect - **`ogx` release builds:** unchanged — bootstrap stays strict (fatal on conflict). - **Pre-rename backfills (`package_name != ogx`):** if the latest auto-instrumentation packages can't be installed cleanly, the image is built **without that per-library auto-instrumentation**, but with the base OTel exporter/distro intact. `OTEL_*`-triggered `opentelemetry-instrument` still works; some library-specific spans may be missing. ## Test plan - `pypi.yml` validated as YAML. - Verified derivation (`ogx` → strict, `llama-stack` → best-effort) and the bootstrap-failure branch logic. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/ogx-ai/ogx/pull/6063" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open in Devin Review"> </picture> </a> <!-- devin-review-badge-end --> Signed-off-by: Charlie Doern <cdoern@redhat.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c274eb1 commit dd8ef2b

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

.github/workflows/pypi.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,9 +973,15 @@ jobs:
973973
# suffix ("llama-stack" -> "llama", "ogx" -> "ogx").
974974
PACKAGE_NAME="${{ inputs.package_name || 'ogx' }}"
975975
CLI_NAME="${PACKAGE_NAME%-stack}"
976+
# Backfilling a non-ogx (pre-rename) package pins old dependencies that
977+
# can conflict with the latest OTel auto-instrumentation packages, so
978+
# make the bootstrap best-effort for those builds. The ogx path stays
979+
# strict.
980+
if [ "$PACKAGE_NAME" == "ogx" ]; then OTEL_BEST_EFFORT=""; else OTEL_BEST_EFFORT="1"; fi
976981
{
977982
echo "package_name=${PACKAGE_NAME}"
978983
echo "cli_name=${CLI_NAME}"
984+
echo "otel_best_effort=${OTEL_BEST_EFFORT}"
979985
} >> "$GITHUB_OUTPUT"
980986
981987
if [ "$EVENT" == "release" ] || [ "$DRY_RUN" == "off" ]; then
@@ -1032,4 +1038,5 @@ jobs:
10321038
INSTALL_MODE=${{ steps.meta.outputs.install_mode }}
10331039
PACKAGE_NAME=${{ steps.meta.outputs.package_name }}
10341040
CLI_NAME=${{ steps.meta.outputs.cli_name }}
1041+
OTEL_BEST_EFFORT=${{ steps.meta.outputs.otel_best_effort }}
10351042
${{ steps.meta.outputs.version_arg }}

containers/Containerfile

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ ARG DISTRO_NAME="starter"
3131
ARG PACKAGE_NAME="ogx"
3232
# CLI binary the package provides (e.g. "ogx", or "llama" for llama-stack).
3333
ARG CLI_NAME="ogx"
34+
# Tolerate failures of the OpenTelemetry per-library bootstrap. Used when
35+
# backfilling older releases whose pinned deps conflict with the latest
36+
# auto-instrumentation packages. The default ("") keeps the bootstrap strict.
37+
ARG OTEL_BEST_EFFORT=""
3438
ARG RUN_CONFIG_PATH=""
3539
ARG UV_HTTP_TIMEOUT=500
3640
ARG UV_EXTRA_INDEX_URL=""
@@ -153,10 +157,22 @@ RUN set -eux; \
153157
printf '%s\n' "$deps" | xargs -L1 uv pip install --no-cache; \
154158
fi
155159

156-
# Install OpenTelemetry auto-instrumentation support
160+
# Install OpenTelemetry auto-instrumentation support.
161+
# The base distro/exporter install is required. The per-library bootstrap
162+
# (opentelemetry-bootstrap -a install) selects the latest instrumentation
163+
# packages, which can conflict with the pinned dependencies of older releases
164+
# being backfilled. With OTEL_BEST_EFFORT=1 a bootstrap failure is logged and
165+
# tolerated instead of failing the build.
157166
RUN set -eux; \
158167
pip install --no-cache opentelemetry-distro opentelemetry-exporter-otlp; \
159-
opentelemetry-bootstrap -a install
168+
if ! opentelemetry-bootstrap -a install; then \
169+
if [ "$OTEL_BEST_EFFORT" = "1" ]; then \
170+
echo "opentelemetry-bootstrap failed; continuing without full auto-instrumentation (OTEL_BEST_EFFORT=1)" >&2; \
171+
else \
172+
echo "opentelemetry-bootstrap failed" >&2; \
173+
exit 1; \
174+
fi; \
175+
fi
160176

161177
# Pre-cache tiktoken cl100k_base encoding at build time so the server never
162178
# attempts a runtime download to openaipublic.blob.core.windows.net.

0 commit comments

Comments
 (0)