diff --git a/apps/statistics/views.py b/apps/statistics/views.py
index aab393625..47b761bed 100644
--- a/apps/statistics/views.py
+++ b/apps/statistics/views.py
@@ -74,6 +74,7 @@ def slow(request):
user_id_counts = {}
path_counts = {}
users = {}
+
for minutes_ago in range(60*6):
dt_ago = now - datetime.timedelta(minutes=minutes_ago)
dt_ago_str = dt_ago.strftime("%a %b %-d, %Y %H:%M")
@@ -105,6 +106,7 @@ def slow(request):
user_counts = []
for user_id, count in user_id_counts.items():
user_counts.append({'user': users[user_id], 'count': count})
+
return render(request, 'statistics/slow.xhtml', {
'all_queries': all_queries,
'user_counts': user_counts,
diff --git a/templates/rss_feeds/status.xhtml b/templates/rss_feeds/status.xhtml
index f88a361d1..88f528f8f 100644
--- a/templates/rss_feeds/status.xhtml
+++ b/templates/rss_feeds/status.xhtml
@@ -2,7 +2,7 @@
{% load utils_tags tz %}
-{% block bodyclass %}NB-body-status{% endblock %}
+{% block bodyclass %}NB-body-status NB-static{% endblock %}
{% block content %}
@@ -21,6 +21,7 @@
Last Update Next Update |
Min to next update |
Decay |
+ Last fetch |
Subs |
Active |
Premium |
@@ -29,11 +30,13 @@
Act. Prem |
Per Month |
Last Month |
+ In Archive |
+ File size (b) |
{% for feed in feeds %}
{{ feed.pk }} |
- {{ feed.feed_title|truncatewords:4 }} |
+ {{ feed.feed_title|truncatewords:4 }} |
{{ feed.last_update|smooth_timedelta }} |
{% localdatetime feed.last_update "%b %d, %Y %H:%M:%S" %}
@@ -42,6 +45,7 @@
|
{{ feed.next_scheduled_update|smooth_timedelta }} |
{{ feed.min_to_decay }} |
+ {{ feed.last_load_time }} |
{{ feed.num_subscribers }} |
{{ feed.active_subscribers }} |
{{ feed.premium_subscribers }} |
@@ -50,6 +54,8 @@
{{ feed.active_premium_subscribers }} |
{{ feed.average_stories_per_month }} |
{{ feed.stories_last_month }} |
+ {{ feed.archive_count }} |
+ {{ feed.fs_size_bytes|commify }} |
{% endfor %}
diff --git a/templates/statistics/slow.xhtml b/templates/statistics/slow.xhtml
index 6986d8ccc..97574524a 100644
--- a/templates/statistics/slow.xhtml
+++ b/templates/statistics/slow.xhtml
@@ -12,7 +12,7 @@
{% for user_count in user_counts %}
- {% if forloop.first %}Users{% endif %}
+ {% if forloop.first %} | Users{% endif %}
| {{ user_count.user }} |
{{ user_count.count }} |
@@ -23,7 +23,7 @@
{% for path, count in path_counts.items %}
- {% if forloop.first %}Paths{% endif %}
+ {% if forloop.first %} | Paths{% endif %}
| {{ path }} |
{{ count }} |
diff --git a/utils/request_introspection_middleware.py b/utils/request_introspection_middleware.py
index ee5268219..7ec0bdf03 100644
--- a/utils/request_introspection_middleware.py
+++ b/utils/request_introspection_middleware.py
@@ -10,6 +10,8 @@ IGNORE_PATHS = [
"/_haproxychk",
]
+RECORD_SLOW_REQUESTS_ABOVE_SECONDS = 10
+
class DumpRequestMiddleware:
def process_request(self, request):
if settings.DEBUG and request.path not in IGNORE_PATHS:
@@ -46,7 +48,7 @@ class DumpRequestMiddleware:
if hasattr(request, 'start_time'):
seconds = time.time() - request.start_time
- if seconds > 10:
+ if seconds > RECORD_SLOW_REQUESTS_ABOVE_SECONDS:
r = redis.Redis(connection_pool=settings.REDIS_STATISTICS_POOL)
pipe = r.pipeline()
minute = round_time(round_to=60)
@@ -54,9 +56,9 @@ class DumpRequestMiddleware:
user_id = request.user.pk if request.user.is_authenticated else "0"
data_string = None
if request.method == "GET":
- data_string = ', '.join([f"{key}={value}" for key, value in request.GET.items()])
+ data_string = ' '.join([f"{key}={value}" for key, value in request.GET.items()])
elif request.method == "GET":
- data_string = ', '.join([f"{key}={value}" for key, value in request.POST.items()])
+ data_string = ' '.join([f"{key}={value}" for key, value in request.POST.items()])
data = {
"user_id": user_id,
"time": round(seconds, 2),