Skip to content

Commit

Permalink
bug-1906113: rename set_up_markus to set_up_metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
willkg committed Aug 12, 2024
1 parent 358201c commit 4c4ffae
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tecken/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from django.apps import AppConfig

from tecken.libdockerflow import get_release_name
from tecken.libmarkus import METRICS, set_up_markus
from tecken.libmarkus import METRICS, set_up_metrics


logger = logging.getLogger("django")
Expand Down Expand Up @@ -104,7 +104,7 @@ def ready(self):

@staticmethod
def _configure_markus():
set_up_markus(
set_up_metrics(
backends=settings.MARKUS_BACKENDS,
hostname=settings.HOSTNAME,
debug=settings.LOCAL_DEV_ENV or settings.TEST_ENV,
Expand Down
10 changes: 5 additions & 5 deletions tecken/libmarkus.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import yaml


_IS_MARKUS_SETUP = False
_IS_MARKUS_SET_UP = False

METRICS = markus.get_metrics("tecken")

Expand All @@ -27,9 +27,9 @@ def _load_registered_metrics():
STATSD_METRICS = _load_registered_metrics()


def set_up_markus(backends, hostname, debug=False):
global _IS_MARKUS_SETUP, METRICS
if _IS_MARKUS_SETUP:
def set_up_metrics(backends, hostname, debug=False):
global _IS_MARKUS_SET_UP, METRICS
if _IS_MARKUS_SET_UP:
return

markus.configure(backends)
Expand All @@ -46,4 +46,4 @@ def set_up_markus(backends, hostname, debug=False):
# Define host tag here instead of in the backend so it shows up in tests
METRICS.filters.append(AddTagFilter(f"host:{hostname}"))

_IS_MARKUS_SETUP = True
_IS_MARKUS_SET_UP = True
4 changes: 2 additions & 2 deletions tecken/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
from tecken.base.symbolstorage import SymbolStorage
from tecken.ext.gcs.storage import GCSStorage
from tecken.ext.s3.storage import S3Storage
from tecken.libmarkus import set_up_markus
from tecken.libmarkus import set_up_metrics
from tecken.libstorage import StorageBackend


def pytest_sessionstart(session):
set_up_markus(
set_up_metrics(
backends=[{"class": "markus.backends.logging.LoggingMetrics"}],
hostname=settings.HOSTNAME,
debug=True,
Expand Down

0 comments on commit 4c4ffae

Please sign in to comment.