LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
UN-2650 [MISC] Fix OpenTelemetry tracing compatibility with uv package manager (#1458)
Chandrasekharan Mdd83fbe1879b
diff --git a/docker/dockerfiles/backend.Dockerfile b/docker/dockerfiles/backend.Dockerfileindex 6ef62c30b..2c0c0626d 100644--- a/docker/dockerfiles/backend.Dockerfile+++ b/docker/dockerfiles/backend.Dockerfile@@ -49,20 +49,22 @@ COPY ${BUILD_CONTEXT_PATH}/pyproject.toml ${BUILD_CONTEXT_PATH}/uv.lock ${BUILD_COPY ${BUILD_PACKAGES_PATH}/ /unstract/# Install external dependencies from pyproject.toml-RUN uv sync --group deploy --locked --no-install-project --no-dev && \- .venv/bin/python3 -m ensurepip --upgrade && \- uv run opentelemetry-bootstrap -a install+RUN uv sync --group deploy --locked --no-install-project --no-dev# -----------------------------------------------# FINAL STAGE - Minimal image for production# -----------------------------------------------FROM ext-dependencies AS production+# Set shell options for better error handling+SHELL ["/bin/bash", "-o", "pipefail", "-c"]+# Copy application code (this layer changes most frequently)COPY ${BUILD_CONTEXT_PATH}/ ./# Install the applicationRUN uv sync --group deploy --locked && \+ uv run opentelemetry-bootstrap -a requirements | uv pip install --requirement - && \chmod +x ./entrypoint.shEXPOSE 8000diff --git a/docker/dockerfiles/platform.Dockerfile b/docker/dockerfiles/platform.Dockerfileindex 2f1f233e1..444355582 100644--- a/docker/dockerfiles/platform.Dockerfile+++ b/docker/dockerfiles/platform.Dockerfile@@ -53,15 +53,16 @@ COPY --chown=${APP_USER}:${APP_USER} ${BUILD_PACKAGES_PATH}/flags /unstract/flagUSER ${APP_USER}# Install external dependencies from pyproject.toml-RUN uv sync --group deploy --locked --no-install-project --no-dev && \- .venv/bin/python3 -m ensurepip --upgrade && \- uv run opentelemetry-bootstrap -a install+RUN uv sync --group deploy --locked --no-install-project --no-dev# -----------------------------------------------# FINAL STAGE - Minimal image for production# -----------------------------------------------FROM ext-dependencies AS production+# Set shell options for better error handling+SHELL ["/bin/bash", "-o", "pipefail", "-c"]+# Copy application code (this layer changes most frequently)COPY --chown=${APP_USER}:${APP_USER} ${BUILD_CONTEXT_PATH} ./@@ -69,7 +70,8 @@ COPY --chown=${APP_USER}:${APP_USER} ${BUILD_CONTEXT_PATH} ./USER ${APP_USER}# Install the application in non-editable mode to avoid permission issues-RUN uv sync --group deploy --locked+RUN uv sync --group deploy --locked && \+ uv run opentelemetry-bootstrap -a requirements | uv pip install --requirement -EXPOSE 3001diff --git a/docker/dockerfiles/prompt.Dockerfile b/docker/dockerfiles/prompt.Dockerfileindex 2d7c6e068..c76edd480 100644--- a/docker/dockerfiles/prompt.Dockerfile+++ b/docker/dockerfiles/prompt.Dockerfile@@ -55,15 +55,16 @@ COPY --chown=${APP_USER}:${APP_USER} ${BUILD_PACKAGES_PATH}/flags /unstract/flagUSER ${APP_USER}# Install external dependencies from pyproject.toml-RUN uv sync --group deploy --locked --no-install-project --no-dev && \- .venv/bin/python3 -m ensurepip --upgrade && \- uv run opentelemetry-bootstrap -a install+RUN uv sync --group deploy --locked --no-install-project --no-dev# -----------------------------------------------# FINAL STAGE - Minimal image for production# -----------------------------------------------FROM ext-dependencies AS production+# Set shell options for better error handling+SHELL ["/bin/bash", "-o", "pipefail", "-c"]+# Copy application code (this layer changes most frequently)COPY --chown=${APP_USER}:${APP_USER} ${BUILD_CONTEXT_PATH} ./@@ -82,7 +83,10 @@ RUN for dir in "${TARGET_PLUGINS_PATH}"/*/; do \uv pip install "${TARGET_PLUGINS_PATH}/${dirname}"; \fi; \done && \- mkdir -p prompt-studio-data+ uv run opentelemetry-bootstrap -a requirements | uv pip install --requirement -++# Create required directories+RUN mkdir -p prompt-studio-dataEXPOSE 3003diff --git a/docker/dockerfiles/runner.Dockerfile b/docker/dockerfiles/runner.Dockerfileindex d3a892a64..fdff0f333 100644--- a/docker/dockerfiles/runner.Dockerfile+++ b/docker/dockerfiles/runner.Dockerfile@@ -46,28 +46,29 @@ COPY ${BUILD_PACKAGES_PATH}/core /unstract/coreCOPY ${BUILD_PACKAGES_PATH}/flags /unstract/flags# Install external dependencies from pyproject.toml-RUN uv sync --group deploy --locked --no-install-project --no-dev && \- .venv/bin/python3 -m ensurepip --upgrade && \- uv run opentelemetry-bootstrap -a install+RUN uv sync --group deploy --locked --no-install-project --no-dev# -----------------------------------------------# FINAL STAGE - Minimal image for production# -----------------------------------------------FROM ext-dependencies AS production+# Set shell options for better error handling+SHELL ["/bin/bash", "-o", "pipefail", "-c"]+# Copy application code (this layer changes most frequently)COPY ${BUILD_CONTEXT_PATH} ./# Install the applicationRUN uv sync --group deploy --no-dev --locked-# Install cloud requirements if they exist-RUN uv pip install --system; \- if [ -f cloud_requirements.txt ]; then \- uv pip install --no-cache-dir -r cloud_requirements.txt; \+# Install cloud requirements if they exist and setup OTEL+RUN if [ -f cloud_requirements.txt ]; then \+ uv pip install -r cloud_requirements.txt; \else \- echo "cloud_requirements.txt does not exist"; \- fi+ echo "cloud_requirements.txt does not exist"; \+ fi && \+ uv run opentelemetry-bootstrap -a requirements | uv pip install --requirement -EXPOSE 5002diff --git a/docker/dockerfiles/tool-sidecar.Dockerfile b/docker/dockerfiles/tool-sidecar.Dockerfileindex 5d21373d8..d9d4b8526 100644--- a/docker/dockerfiles/tool-sidecar.Dockerfile+++ b/docker/dockerfiles/tool-sidecar.Dockerfile@@ -52,15 +52,16 @@ COPY --chown=${APP_USER}:${APP_USER} ${BUILD_PACKAGES_PATH}/core /unstract/coreUSER ${APP_USER}# Install external dependencies from pyproject.toml-RUN uv sync --group deploy --locked --no-install-project --no-dev && \- .venv/bin/python3 -m ensurepip --upgrade && \- uv run opentelemetry-bootstrap -a install+RUN uv sync --group deploy --locked --no-install-project --no-dev# -----------------------------------------------# FINAL STAGE - Minimal image for production# -----------------------------------------------FROM ext-dependencies AS production+# Set shell options for better error handling+SHELL ["/bin/bash", "-o", "pipefail", "-c"]+# Copy application code (this layer changes most frequently)COPY --chown=${APP_USER}:${APP_USER} ${BUILD_CONTEXT_PATH} ./@@ -69,9 +70,7 @@ USER ${APP_USER}# Install just the applicationRUN uv sync --group deploy --locked && \+ uv run opentelemetry-bootstrap -a requirements | uv pip install --requirement - && \chmod +x ./entrypoint.sh-# # Make entrypoint executable-# RUN chmod +x ./entrypoint.sh-CMD ["./entrypoint.sh"]diff --git a/docker/dockerfiles/x2text.Dockerfile b/docker/dockerfiles/x2text.Dockerfileindex 231e2b784..e5011b841 100644--- a/docker/dockerfiles/x2text.Dockerfile+++ b/docker/dockerfiles/x2text.Dockerfile@@ -48,15 +48,16 @@ COPY ${BUILD_CONTEXT_PATH}/pyproject.toml ${BUILD_CONTEXT_PATH}/uv.lock ${BUILD_USER ${APP_USER}# Install external dependencies from pyproject.toml-RUN uv sync --group deploy --locked --no-install-project --no-dev && \- .venv/bin/python3 -m ensurepip --upgrade && \- uv run opentelemetry-bootstrap -a install+RUN uv sync --group deploy --locked --no-install-project --no-dev# -----------------------------------------------# FINAL STAGE - Minimal image for production# -----------------------------------------------FROM ext-dependencies AS production+# Set shell options for better error handling+SHELL ["/bin/bash", "-o", "pipefail", "-c"]+# Copy application code (this layer changes most frequently)COPY --chown=${APP_USER}:${APP_USER} ${BUILD_CONTEXT_PATH} ./@@ -64,7 +65,8 @@ COPY --chown=${APP_USER}:${APP_USER} ${BUILD_CONTEXT_PATH} ./USER ${APP_USER}# Install just the application-RUN uv sync --group deploy --locked+RUN uv sync --group deploy --locked && \+ uv run opentelemetry-bootstrap -a requirements | uv pip install --requirement -EXPOSE 3004diff --git a/tools/structure/Dockerfile b/tools/structure/Dockerfileindex e4d832a7e..e98133ec3 100644--- a/tools/structure/Dockerfile+++ b/tools/structure/Dockerfile@@ -39,12 +39,15 @@ COPY requirements.txt ${APP_HOME}/RUN uv pip install --system \opentelemetry-distro \opentelemetry-exporter-otlp \- platformdirs>=3.0.0 && \- opentelemetry-bootstrap -a install+ platformdirs>=3.0.0++# Set shell options for better error handling+SHELL ["/bin/bash", "-o", "pipefail", "-c"]# Install project dependencies separately from OpenTelemetry# This allows for better caching when only project dependencies change-RUN uv pip install --system -r requirements.txt+RUN uv pip install --system -r requirements.txt && \+ opentelemetry-bootstrap -a requirements | uv pip install --system --requirement -# Copy the source code after installing all dependencies# This ensures that changes to the source code don't invalidate the dependency layers