Implemented cleanup/triage direction. ui, and baselinbe days
This commit is contained in:
@@ -130,3 +130,20 @@ class BaselineTests(unittest.TestCase):
|
||||
|
||||
self.assertLessEqual(len(rare), 5)
|
||||
self.assertTrue(all(item["score"] >= 15 for item in rare))
|
||||
|
||||
def test_training_days_gate_profile_deviations(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
store = BaselineStore(str(Path(directory) / "baseline.sqlite3"))
|
||||
profiles = parse_profiles([{"stream_id": "windows", "entity_field": "username", "categorical_fields": ["action"]}])
|
||||
now = int(time.time())
|
||||
for index in range(12):
|
||||
event = parse_log_line(f"fgai_stream_id=windows username=alice action=failed baseline={index}")
|
||||
store.ingest_profile_fields([event], profiles, observed_at=now - 86400 + index * 300)
|
||||
|
||||
burst = [
|
||||
parse_log_line(f"fgai_stream_id=windows username=alice action=failed burst={index}")
|
||||
for index in range(5)
|
||||
]
|
||||
|
||||
self.assertNotIn("alice", store.profile_deviations(burst, profiles, min_training_days=7))
|
||||
self.assertIn("alice", store.profile_deviations(burst, profiles, min_training_days=0))
|
||||
|
||||
Reference in New Issue
Block a user