Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
Disable DataDog logging for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericisaiah committed Sep 9, 2021
1 parent 050bcfc commit ad9b08f
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 17 deletions.
4 changes: 2 additions & 2 deletions app/app/celery_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")

if os.environ.get("DATADOG_API_KEY"):
ddtrace.patch_all()
# if os.environ.get("DATADOG_API_KEY"):
# ddtrace.patch_all()

app = celery.Celery("uptime")

Expand Down
10 changes: 5 additions & 5 deletions app/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@
"handlers": [handler],
"level": env.str("DJANGO_LOGGING_LEVEL", default="INFO"),
},
"ddtrace": {
"handlers": [handler],
"level": env.str("DJANGO_LOGGING_LEVEL", default="INFO"),
},
# "ddtrace": {
# "handlers": [handler],
# "level": env.str("DJANGO_LOGGING_LEVEL", default="INFO"),
# },
"common": {
"handlers": [handler],
"level": env.str("DJANGO_LOGGING_LEVEL", default="INFO"),
Expand Down Expand Up @@ -248,7 +248,7 @@

#### DATADOG CONFIGURATION

ddtrace.tracer.set_tags({"build": BUILD})
# ddtrace.tracer.set_tags({"build": BUILD})

#### END DATADOG CONFIGURATION

Expand Down
10 changes: 5 additions & 5 deletions app/app/wsgi_prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

from common.apm import tracer

ddtrace.patch_all()
ddtrace.patch(gevent=True)
# ddtrace.patch_all()
# ddtrace.patch(gevent=True)

ddtrace.Pin.override(django, tracer=tracer)
ddtrace.Pin.override(psycopg2, tracer=tracer)
ddtrace.Pin.override(redis, tracer=tracer)
# ddtrace.Pin.override(django, tracer=tracer)
# ddtrace.Pin.override(psycopg2, tracer=tracer)
# ddtrace.Pin.override(redis, tracer=tracer)

monkey.patch_all()

Expand Down
6 changes: 4 additions & 2 deletions app/common/apm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@

logger = logging.getLogger("apm")

# Return before writing to DataDog for now instead of removing
# the code so we can reactivate it easily later when needed.

class UptimeTracer(Tracer):
def write(self, spans):
logger.debug(spans)
if settings.DEBUG:
return
# if settings.DEBUG:
return # return to under If to restore DataDog logging
return super().write(spans)


Expand Down
4 changes: 3 additions & 1 deletion app/ops/beat_launch.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

ddtrace-run celery -A app.celery_beat beat --scheduler redbeat.RedBeatScheduler --pidfile="/app/celerybeat-checkable.pid"
# Uncomment and have this command run the following to restore DataDog logging
# ddtrace-run
celery -A app.celery_beat beat --scheduler redbeat.RedBeatScheduler --pidfile="/app/celerybeat-checkable.pid"
4 changes: 3 additions & 1 deletion app/ops/migration_launch.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

ddtrace-run python /app/manage.py migrate
# Uncomment and have this command run the following to restore DataDog logging
# ddtrace-run
python /app/manage.py migrate
4 changes: 3 additions & 1 deletion app/ops/worker_launch.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

ddtrace-run celery -A app.celery_app worker -Q ${1} --without-heartbeat --without-mingle --without-gossip
# Uncomment and have this command run the following to restore DataDog logging
# ddtrace-run
celery -A app.celery_app worker -Q ${1} --without-heartbeat --without-mingle --without-gossip

0 comments on commit ad9b08f

Please sign in to comment.