Add webhook queue monitoring

This commit is contained in:
Ignas Kiela 2021-12-08 10:27:34 +02:00 committed by Drew DeVault
parent ac9f3aa1d3
commit 320a5e8f7c
2 changed files with 8 additions and 1 deletions

View File

@ -43,6 +43,9 @@ class TodoApp(SrhtFlask):
self.add_template_filter(urls.tracker_url)
self.add_template_filter(urls.user_url)
from todosrht.webhooks import webhook_metrics_collector
self.metrics_registry.register(webhook_metrics_collector)
@self.context_processor
def inject():
return {

View File

@ -7,9 +7,13 @@ if not hasattr(db, "session"):
db.init()
from srht.webhook import Event
from srht.webhook.celery import CeleryWebhook, make_worker
from srht.metrics import RedisQueueCollector
import sqlalchemy as sa
worker = make_worker(broker=cfg("todo.sr.ht", "webhooks"))
webhooks_broker = cfg("todo.sr.ht", "webhooks")
worker = make_worker(broker=webhooks_broker)
webhook_metrics_collector = RedisQueueCollector(webhook_broker, "srht_webhooks", "Webhook queue length")
import todosrht.tracker_import