mirror of
https://gitlab.com/tildes/tildes.git
synced 2026-04-17 06:48:36 +02:00
Add temporary metric for theme cookie tween
I'm going to make some changes to this tween, so the metric will help me keep an eye on how often it's triggering, which should make it easier to be sure the changes are working as expected.
This commit is contained in:
@@ -31,6 +31,9 @@ _COUNTERS = {
|
||||
"login_failures": Counter("tildes_login_failures_total", "Login Failures"),
|
||||
"messages": Counter("tildes_messages_total", "Messages", labelnames=["type"]),
|
||||
"registrations": Counter("tildes_registrations_total", "User Registrations"),
|
||||
"theme_cookie_tween_sets": Counter(
|
||||
"tildes_theme_cookie_tween_sets_total", "Theme Cookies Set by Tween"
|
||||
),
|
||||
"topics": Counter("tildes_topics_total", "Topics", labelnames=["type"]),
|
||||
"subscriptions": Counter("tildes_subscriptions_total", "Subscriptions"),
|
||||
"unsubscriptions": Counter("tildes_unsubscriptions_total", "Unsubscriptions"),
|
||||
|
||||
@@ -11,6 +11,8 @@ from pyramid.registry import Registry
|
||||
from pyramid.request import Request
|
||||
from pyramid.response import Response
|
||||
|
||||
from tildes.metrics import incr_counter
|
||||
|
||||
|
||||
def http_method_tween_factory(handler: Callable, registry: Registry) -> Callable:
|
||||
# pylint: disable=unused-argument
|
||||
@@ -95,6 +97,8 @@ def theme_cookie_tween_factory(handler: Callable, registry: Registry) -> Callabl
|
||||
secure=True,
|
||||
domain="." + request.domain,
|
||||
)
|
||||
incr_counter("theme_cookie_tween_sets")
|
||||
|
||||
return response
|
||||
|
||||
return theme_cookie_tween
|
||||
|
||||
Reference in New Issue
Block a user