fix(worktime): isolate global session collector and reset RDP bridge flow

This commit is contained in:
igor04091968
2026-05-13 08:18:47 +03:00
parent b69f4d83cc
commit f6ee903b10
8 changed files with 163 additions and 29 deletions
+2 -1
View File
@@ -42,7 +42,8 @@ def _is_active_sample(data: dict) -> bool:
except Exception:
sid = -1
user = str(data.get("username") or "").strip()
if sid > 0 and user and (not _is_machine_user(user)):
session_name = str(data.get("sessionName") or "").strip().lower()
if sid > 0 and user and (not _is_machine_user(user)) and (session_name.startswith("rdp-") or session_name == "console"):
return True
return False
+2 -1
View File
@@ -112,7 +112,8 @@ def is_active(d):
try: sid=int(d.get("sessionId"))
except: sid=-1
u=str(d.get("username","")).strip().lower()
if sid>0 and u and (not u.endswith("$")): return True
sn=str(d.get("sessionName","")).strip().lower()
if sid>0 and u and (not u.endswith("$")) and (sn.startswith("rdp-") or sn=="console"): return True
return False
rows=req("GET",f"/api/0/buckets/{sb}/events?limit=12000") or []
+7 -2
View File
@@ -96,7 +96,8 @@ def _is_session_active(row_data):
except Exception:
sid = -1
user = str(row_data.get("username", "")).strip().lower()
if sid > 0 and user and (not user.endswith("$")):
session_name = str(row_data.get("sessionName", "")).strip().lower()
if sid > 0 and user and (not user.endswith("$")) and (session_name.startswith("rdp-") or session_name == "console"):
return True
return False
@@ -111,7 +112,11 @@ def transform(events):
ts = e.get("timestamp")
if not ts:
continue
grouped.setdefault(ts, []).append(e)
try:
normalized_ts = to_iso_utc(parse_iso_utc(ts).replace(microsecond=0).isoformat())
except Exception:
normalized_ts = ts
grouped.setdefault(normalized_ts, []).append(e)
ordered_ts = sorted(grouped.keys())
parsed_ts = {}