|
1 | 1 | import argparse |
2 | | -from functools import lru_cache |
3 | 2 | from typing import Any |
4 | 3 |
|
5 | 4 | from django.core.handlers.wsgi import WSGIHandler |
6 | 5 | from django.core.wsgi import get_wsgi_application |
7 | | -from django.urls import Resolver404, resolve |
8 | 6 | from environs import Env |
9 | 7 | from gunicorn.app.wsgiapp import ( # type: ignore[import-untyped] |
10 | 8 | WSGIApplication as GunicornWSGIApplication, |
11 | 9 | ) |
12 | 10 | from gunicorn.config import Config # type: ignore[import-untyped] |
13 | 11 |
|
14 | | -from common.prometheus.constants import UNKNOWN_LABEL_VALUE |
15 | | -from common.prometheus.types import LabelValue |
16 | | - |
17 | 12 | env = Env() |
18 | 13 |
|
19 | 14 | DEFAULT_ACCESS_LOG_FORMAT = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" %({origin}i)s %({access-control-allow-origin}o)s' |
@@ -54,19 +49,6 @@ def load_wsgiapp(self) -> WSGIHandler: |
54 | 49 | return get_wsgi_application() |
55 | 50 |
|
56 | 51 |
|
57 | | -@lru_cache(maxsize=64) |
58 | | -def get_status_from_wsgi_response_status( |
59 | | - status: str | bytes | int | None, |
60 | | -) -> str | None: |
61 | | - if isinstance(status, int): |
62 | | - return str(status) |
63 | | - if isinstance(status, bytes): |
64 | | - status = status.decode("utf-8") |
65 | | - if isinstance(status, str): |
66 | | - status = status.split(None, 1)[0] |
67 | | - return status |
68 | | - |
69 | | - |
70 | 52 | def add_arguments(parser: argparse._ArgumentGroup) -> None: |
71 | 53 | _config = Config() |
72 | 54 | keys = sorted(_config.settings, key=_config.settings.__getitem__) |
|
0 commit comments