prometheus: add monitoring of nomber of items in uwsgi spooler (#88690)
gitea/publik-infra/pipeline/head This commit looks good
Details
gitea/publik-infra/pipeline/head This commit looks good
Details
This commit is contained in:
parent
e33bec7506
commit
c20d1b7bac
|
@ -38,13 +38,22 @@ uwsgi_workers_vsz_total = Gauge(
|
|||
uwsgi_workers_status = Gauge(
|
||||
'uwsgi_workers_status', 'uwsgi workers status', ['app', 'status'], registry=registry
|
||||
)
|
||||
uwsgi_spooler_count = Gauge('uwsgi_spooler_count', 'uwsgi spooler count', ['app'], registry=registry)
|
||||
|
||||
|
||||
app_name = None
|
||||
|
||||
for stats_sock in glob.glob('/run/*/stats.sock'):
|
||||
app_name = stats_sock.split('/')[2]
|
||||
app_name = app_name.replace('authentic2-multitenant', 'authentic')
|
||||
uwsgi_app_name = stats_sock.split('/')[2]
|
||||
app_name = uwsgi_app_name.replace('authentic2-multitenant', 'authentic')
|
||||
|
||||
with open('/etc/machine-id') as fd:
|
||||
machine_id = fd.read().strip()
|
||||
|
||||
spooler_dir = f'/var/lib/{uwsgi_app_name}/spooler/{machine_id}'
|
||||
if os.path.exists(spooler_dir):
|
||||
uwsgi_spooler_count.labels(app=app_name).set(len(os.listdir(spooler_dir)))
|
||||
|
||||
if app_name == 'authentic':
|
||||
# do not collect authentic data as it triggers some uwsgi bug
|
||||
# https://dev.entrouvert.org/issues/54624
|
||||
|
|
Loading…
Reference in New Issue