53e2b2c784
* admin: add worker metrics Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * admin: add version metrics Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * events: add gauge for system tasks Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * outposts: add gauge for last hello and connection status Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * root: re-add prometheus metrics to database Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * root: allow access to metrics without credentials when debug is on Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * root: add UpdatingGauge to auto-set value on load Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * flows: add metrics for cache and building Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * policies: add metrics for policy engine Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * events: add histogram for task durations Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * events: revert to gauge because values are updated on export view Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * core: add gauge to count all models Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * events: add metrics for events Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
31 lines
896 B
Python
31 lines
896 B
Python
"""authentik core app config"""
|
|
from importlib import import_module
|
|
|
|
from django.apps import AppConfig
|
|
from django.db import ProgrammingError
|
|
|
|
from authentik.core.signals import GAUGE_MODELS
|
|
from authentik.lib.utils.reflection import get_apps
|
|
|
|
|
|
class AuthentikCoreConfig(AppConfig):
|
|
"""authentik core app config"""
|
|
|
|
name = "authentik.core"
|
|
label = "authentik_core"
|
|
verbose_name = "authentik Core"
|
|
mountpoint = ""
|
|
|
|
def ready(self):
|
|
import_module("authentik.core.signals")
|
|
import_module("authentik.core.managed")
|
|
try:
|
|
for app in get_apps():
|
|
for model in app.get_models():
|
|
GAUGE_MODELS.labels(
|
|
model_name=model._meta.model_name,
|
|
app=model._meta.app_label,
|
|
).set(model.objects.count())
|
|
except ProgrammingError:
|
|
pass
|