Skip to content

Commit

Permalink
bug-1847235: move markus usage to hook function
Browse files Browse the repository at this point in the history
We don't want the gunicorn manager process to import Tecken webapp
stuff, so this moves importing markus and creating a markus client to
the point where it's used.
  • Loading branch information
willkg committed Dec 4, 2023
1 parent 4ce46fb commit 2870988
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tecken/gunicornhooks.py
Expand Up @@ -7,14 +7,10 @@
See https://docs.gunicorn.org/en/stable/settings.html#server-hooks
Note: Don't import anything that involves Django machinery here.
Note: This file is imported by the Gunicorn manager, so don't import anything that
involves Tecken webapp machinery here.
"""

import markus


metrics = markus.get_metrics("tecken")


def worker_abort(worker):
"""Emit metric when a Gunicorn worker is terminated from timeout
Expand All @@ -25,4 +21,7 @@ def worker_abort(worker):
markus and logging configuration of the Django webapp.
"""
import markus

metrics = markus.get_metrics("tecken")
metrics.incr("gunicorn_worker_abort")

0 comments on commit 2870988

Please sign in to comment.