Show recent sample when incidents diff is empty
This commit is contained in:
@@ -438,6 +438,15 @@ async def incidents_diff(msg: Message):
|
|||||||
|
|
||||||
if not fresh:
|
if not fresh:
|
||||||
note = f"since {last_dt.astimezone().strftime('%Y-%m-%d %H:%M')}" if last_dt else "for the period"
|
note = f"since {last_dt.astimezone().strftime('%Y-%m-%d %H:%M')}" if last_dt else "for the period"
|
||||||
|
if rows:
|
||||||
|
sample = rows[-50:]
|
||||||
|
body = "\n".join(f"{dt.astimezone().strftime('%m-%d %H:%M')} {line}" for dt, line in sample)
|
||||||
|
await msg.answer(
|
||||||
|
f"📣 No new incidents {note} (window {hours}h).\nRecent sample:\n```\n{body}\n```",
|
||||||
|
reply_markup=system_logs_audit_kb,
|
||||||
|
parse_mode="Markdown",
|
||||||
|
)
|
||||||
|
else:
|
||||||
await msg.answer(f"📣 No new incidents {note} (window {hours}h)", reply_markup=system_logs_audit_kb)
|
await msg.answer(f"📣 No new incidents {note} (window {hours}h)", reply_markup=system_logs_audit_kb)
|
||||||
return
|
return
|
||||||
fresh.sort(key=lambda x: x[0])
|
fresh.sort(key=lambda x: x[0])
|
||||||
|
|||||||
Reference in New Issue
Block a user