Add backlog metrics
continuous-integration/drone Build is passing
Details
continuous-integration/drone Build is passing
Details
This commit is contained in:
parent
4d90244507
commit
c23694559a
|
@ -65,6 +65,9 @@ host_info = {
|
||||||
|
|
||||||
log_files = dict()
|
log_files = dict()
|
||||||
|
|
||||||
|
gauge_backlog_size = Gauge(
|
||||||
|
"logmower_backlog_size_bytes",
|
||||||
|
"Content that is yet to be submitted")
|
||||||
gauge_log_files = Gauge(
|
gauge_log_files = Gauge(
|
||||||
"logmower_log_file_count",
|
"logmower_log_file_count",
|
||||||
"Number of tracked log files",
|
"Number of tracked log files",
|
||||||
|
@ -495,6 +498,7 @@ async def watcher(loop, queue, coll):
|
||||||
|
|
||||||
@app.route("/metrics")
|
@app.route("/metrics")
|
||||||
async def handler(request):
|
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()])
|
c = collections.Counter([j.state for j in log_files.values()])
|
||||||
for key in ("seeking", "replaying", "watching", "closing"):
|
for key in ("seeking", "replaying", "watching", "closing"):
|
||||||
gauge_log_files.labels(key).set(c[key])
|
gauge_log_files.labels(key).set(c[key])
|
||||||
|
|
Loading…
Reference in New Issue