feat(observability): add structured application logging
Emit correlated JSON logs from the API and FunASR services, propagate request IDs to the client, and configure bounded opt-in Docker logging. Document the host-wide Grafana/Loki query workflow and keep observability deployment ownership outside the application repository.
This commit is contained in:
@@ -2,10 +2,16 @@ FROM python:3.10-slim
|
||||
|
||||
ARG DEBIAN_MIRROR=http://deb.debian.org
|
||||
ARG PYPI_INDEX_URL=https://pypi.org/simple
|
||||
ARG APP_VERSION=0.2.0
|
||||
ARG GIT_SHA=unknown
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PIP_NO_CACHE_DIR=1
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
APP_ENV=lan \
|
||||
APP_VERSION=${APP_VERSION} \
|
||||
GIT_SHA=${GIT_SHA} \
|
||||
LOG_FORMAT=json
|
||||
|
||||
RUN sed -i "s|http://deb.debian.org|${DEBIAN_MIRROR}|g" /etc/apt/sources.list.d/debian.sources \
|
||||
&& apt-get update \
|
||||
@@ -18,7 +24,7 @@ RUN pip install --index-url "${PYPI_INDEX_URL}" --upgrade pip
|
||||
RUN pip install torch==2.8.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cpu
|
||||
RUN pip install --index-url "${PYPI_INDEX_URL}" -r requirements.txt
|
||||
|
||||
COPY app.py ./
|
||||
COPY app.py logging_config.py ./
|
||||
|
||||
EXPOSE 10095
|
||||
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "10095", "--workers", "1", "--no-access-log"]
|
||||
|
||||
Reference in New Issue
Block a user