Merge branch 'stranck-dev' of https://git.foxo.me/Furizon/furizon_webint into stranck-dev
This commit is contained in:
commit
99b8c87e5c
14
metrics.py
14
metrics.py
|
@ -50,17 +50,29 @@ def getRoomCountersText(request):
|
||||||
try :
|
try :
|
||||||
daily = 0
|
daily = 0
|
||||||
counters = {}
|
counters = {}
|
||||||
|
counters_early = {}
|
||||||
|
counters_late = {}
|
||||||
for id in ROOM_TYPE_NAMES.keys():
|
for id in ROOM_TYPE_NAMES.keys():
|
||||||
counters[id] = 0
|
counters[id] = 0
|
||||||
|
counters_early[id] = 0
|
||||||
|
counters_late[id] = 0
|
||||||
|
|
||||||
for order in request.app.ctx.om.cache.values():
|
for order in request.app.ctx.om.cache.values():
|
||||||
if(order.daily):
|
if(order.daily):
|
||||||
daily += 1
|
daily += 1
|
||||||
else:
|
else:
|
||||||
counters[order.bed_in_room] += 1
|
counters[order.bed_in_room] += 1
|
||||||
|
if(order.has_early):
|
||||||
|
counters_early[order.bed_in_room] += 1
|
||||||
|
if(order.has_late):
|
||||||
|
counters_late[order.bed_in_room] += 1
|
||||||
|
|
||||||
for id, count in counters.items():
|
for id, count in counters.items():
|
||||||
out.append(f'webint_order_room_counter{{label="{ROOM_TYPE_NAMES[id]}"}} {count}')
|
out.append(f'webint_order_room_counter{{days="normal", label="{ROOM_TYPE_NAMES[id]}"}} {count}')
|
||||||
|
for id, count in counters_early.items():
|
||||||
|
out.append(f'webint_order_room_counter{{days="early", label="{ROOM_TYPE_NAMES[id]}"}} {count}')
|
||||||
|
for id, count in counters_late.items():
|
||||||
|
out.append(f'webint_order_room_counter{{days="late", label="{ROOM_TYPE_NAMES[id]}"}} {count}')
|
||||||
out.append(f'webint_order_room_counter{{label="Daily"}} {daily}')
|
out.append(f'webint_order_room_counter{{label="Daily"}} {daily}')
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Reference in New Issue