9
0
Fork 0

Add backlog metrics
continuous-integration/drone Build is passing Details

This commit is contained in:
Lauri Võsandi 2022-11-07 21:42:09 +02:00
parent 4d90244507
commit c23694559a
1 changed files with 4 additions and 0 deletions

View File

@ -65,6 +65,9 @@ host_info = {
log_files = dict()
gauge_backlog_size = Gauge(
"logmower_backlog_size_bytes",
"Content that is yet to be submitted")
gauge_log_files = Gauge(
"logmower_log_file_count",
"Number of tracked log files",
@ -495,6 +498,7 @@ async def watcher(loop, queue, coll):
@app.route("/metrics")
async def handler(request):
gauge_backlog_size.set(sum([j.tail - j.head for j in log_files.values()]))
c = collections.Counter([j.state for j in log_files.values()])
for key in ("seeking", "replaying", "watching", "closing"):
gauge_log_files.labels(key).set(c[key])