Skip to content

Commit

Permalink
RSPY-518 - Bootstrap Opentelemetry for rs-server-staging
Browse files Browse the repository at this point in the history
  • Loading branch information
vprivat-ads committed Nov 18, 2024
1 parent b6fd7ea commit dcc90e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion services/staging/.github/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,15 @@ FROM python:3.11-slim-bookworm
# Install dependencies necessary for execution (e.g. libpq) not compilation (gcc)
RUN \
apt update && \
apt install -y libpq-dev && \
apt install -y libpq-dev libexpat1 && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*

# Copy the whole /usr/local dir (that contains the python installation) from the build stage
COPY --from=builder /usr/local /usr/local

# Install opentelemetry instrumentation packages for dependencies
RUN opentelemetry-bootstrap -a install

# Clean everything
RUN rm -rf /tmp/whl /root/.cache/pip /var/cache/apt/archives /var/lib/apt/lists/*

Expand Down
4 changes: 4 additions & 0 deletions services/staging/rs_server_staging/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
init_rs_server_config_yaml,
)
from rs_server_common.settings import env_bool
from rs_server_common.utils import opentelemetry
from rs_server_common.utils.logging import Logging
from rs_server_staging.processors import processors
from starlette.exceptions import HTTPException as StarletteHTTPException
Expand Down Expand Up @@ -240,6 +241,9 @@ async def get_specific_job_result(job_id):
raise HTTPException(status_code=HTTP_404_NOT_FOUND, detail=f"Job with ID {job_id} not found")


# Configure OpenTelemetry
opentelemetry.init_traces(app, "rs.server.staging")

app.include_router(router)
app.router.lifespan_context = app_lifespan

Expand Down

0 comments on commit dcc90e9

Please sign in to comment.