Skip to content

Commit

Permalink
Integrate datadog to pusher for logs and traces (#1312)
Browse files Browse the repository at this point in the history
Issue #1217

**Key changes:**
- Add ddtrace library for pusher
- Wrap application to datadog serverless-init to collect traces and logs
  • Loading branch information
beastoin authored Nov 14, 2024
2 parents ed7d750 + e93b95a commit 20d54be
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/gcp_backend_pusher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: ./backend/pusher/Dockerfile
file: ./backend/pusher/Dockerfile.datadog
push: true
tags: gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }}:latest
cache-from: type=registry,ref=gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }}:buildcache
Expand Down
24 changes: 24 additions & 0 deletions backend/pusher/Dockerfile.datadog
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM python:3.11 AS builder

ENV PATH="/opt/venv/bin:$PATH"
RUN python -m venv /opt/venv

COPY backend/requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /tmp/requirements.txt

FROM python:3.11-slim

WORKDIR /app
ENV PATH="/opt/venv/bin:$PATH"

RUN apt-get update && apt-get -y install ffmpeg curl unzip && rm -rf /var/lib/apt/lists/* && \
pip install --target /dd_tracer/python/ ddtrace

COPY --from=builder /opt/venv /opt/venv
COPY --from=gcr.io/datadoghq/serverless-init:1 /datadog-init /app/datadog-init
COPY backend/ .

EXPOSE 8080
ENTRYPOINT ["/app/datadog-init"]
CMD ["/dd_tracer/python/bin/ddtrace-run", "uvicorn", "pusher.main:app", "--host", "0.0.0.0", "--port", "8080"]

0 comments on commit 20d54be

Please sign in to comment.