Skip to content

Commit

Permalink
🐳 Alter docker setup to use Open Telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbal committed Apr 4, 2022
1 parent 795bd3a commit 4462680
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \

COPY --from=build /usr/local/lib/python3.7 /usr/local/lib/python3.7
COPY --from=build /usr/local/bin/uwsgi /usr/local/bin/uwsgi
COPY --from=build /usr/local/bin/opentelemetry-instrument /usr/local/bin/opentelemetry-instrument

# Stage 3.2 - Copy source code
WORKDIR /app
Expand Down
4 changes: 2 additions & 2 deletions bin/docker_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ fi

# Start server
>&2 echo "Starting server"
uwsgi \
cd src/
opentelemetry-instrument uwsgi \
--http :$uwsgi_port \
--http-keepalive \
--manage-script-name \
--mount $mountpoint=objects.wsgi:application \
--static-map /static=/app/static \
--static-map /media=/app/media \
--chdir src \
--enable-threads \
--processes $uwsgi_processes \
--threads $uwsgi_threads \
Expand Down
4 changes: 4 additions & 0 deletions src/manage.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/usr/bin/env python
import sys

from opentelemetry.instrumentation.django import DjangoInstrumentor
from objects.setup import setup_env

if __name__ == "__main__":
setup_env()

# This call is what makes the Django application be instrumented
DjangoInstrumentor().instrument()

try:
from django.core.management import execute_from_command_line
except ImportError:
Expand Down

0 comments on commit 4462680

Please sign in to comment.