fixed system page

This commit is contained in:
vabene1111
2024-11-23 13:26:12 +01:00
parent 70d2dc089c
commit d4dc4a30b8
3 changed files with 30 additions and 25 deletions

View File

@@ -175,7 +175,7 @@
{#{% for orphan in orphans %}{{ orphan }}#}
{#{% endfor %}#}
{# </textarea>#}
{% if api_space_stats %}
<h4 class="mt-3">API Stats</h4>
<h6 >Space Stats</h6>
<table class="table table-bordered table-striped">
@@ -202,7 +202,7 @@
</tr>
{% endfor %}
</table>
{% endif %}
<h4 class="mt-3">Debug</h4>
<textarea class="form-control" rows="20">
Gunicorn Media: {{ gunicorn_media }}

View File

@@ -112,6 +112,7 @@ class LoggingMixin(object):
super(LoggingMixin, self).initial(request, *args, **kwargs)
if settings.REDIS_HOST:
try:
d = date.today().isoformat()
space = request.space
endpoint = request.resolver_match.url_name
@@ -141,6 +142,8 @@ class LoggingMixin(object):
pipe.zincrby(f'api:endpoint-request-count:{d}', 1, endpoint)
pipe.execute()
except:
pass
class StandardFilterMixin(ViewSetMixin):

View File

@@ -346,6 +346,8 @@ def system(request):
for key in migration_info.keys():
migration_info[key]['total'] = len(migration_info[key]['unapplied_migrations']) + len(migration_info[key]['applied_migrations'])
api_stats = None
api_space_stats = None
# API endpoint logging
if settings.REDIS_HOST:
r = redis.StrictRedis(