Fortsatte roadmapen med multi-entity stream profiles

This commit is contained in:
larssand
2026-06-29 19:08:23 +02:00
parent 20b0e0a92e
commit 68370217da
10 changed files with 102 additions and 60 deletions

View File

@@ -28,6 +28,17 @@ class BaselineTests(unittest.TestCase):
self.assertEqual(store.ingest_profile_fields(events, profiles, observed_at=1_700_000_000), 1)
self.assertEqual(store.ingest_profile_fields(events, profiles, observed_at=1_700_000_300), 0)
def test_profile_can_baseline_multiple_entities_from_same_event(self):
with tempfile.TemporaryDirectory() as directory:
store = BaselineStore(str(Path(directory) / "baseline.sqlite3"))
profiles = parse_profiles([{"stream_id": "vpn", "entity_fields": ["username", "srcip"], "categorical_fields": ["action"]}])
events = [parse_log_line("fgai_stream_id=vpn username=alice srcip=10.0.0.5 action=login")]
self.assertEqual(store.ingest_profile_fields(events, profiles, observed_at=1_700_000_000), 2)
readiness = store.profile_readiness(profiles)
self.assertEqual(readiness[0]["buckets"], 1)
def test_profile_rate_burst_is_one_confident_detector(self):
with tempfile.TemporaryDirectory() as directory:
store = BaselineStore(str(Path(directory) / "baseline.sqlite3"))