Skip to content

Commit

Permalink
Break reference cycle with log formatter (#6470)
Browse files Browse the repository at this point in the history
Once check_id is set, we don't need to keep the reference to check. It
could help garbage collect check instances.
  • Loading branch information
therve authored Apr 24, 2020
1 parent 40df746 commit b32fc38
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions datadog_checks_base/datadog_checks/base/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def process(self, msg, kwargs):
# Default to `unknown` for checks that log during
# `__init__` and therefore have no `check_id` yet
self.extra['_check_id'] = self.check_id or 'unknown'
if self.check_id:
# Break the reference cycle, once we resolved check_id we don't need the check anymore
self.check = None

kwargs.setdefault('extra', self.extra)
return msg, kwargs
Expand Down

0 comments on commit b32fc38

Please sign in to comment.