diff --git a/src/Backend/AutopilotMonitor.Functions.Tests/SessionIndexFieldManifestTests.cs b/src/Backend/AutopilotMonitor.Functions.Tests/SessionIndexFieldManifestTests.cs index 6a159402..d63375ac 100644 --- a/src/Backend/AutopilotMonitor.Functions.Tests/SessionIndexFieldManifestTests.cs +++ b/src/Backend/AutopilotMonitor.Functions.Tests/SessionIndexFieldManifestTests.cs @@ -90,6 +90,7 @@ public class SessionIndexFieldManifestTests ["DiagnosticsBlobName"] = "diag-0001.zip", ["DiagnosticsBlobDestination"] = "Hosted", ["LastEventAt"] = new DateTimeOffset(StartedAt.AddMinutes(44)), + ["LastIngestAt"] = new DateTimeOffset(StartedAt.AddMinutes(46)), ["ResumedAt"] = new DateTimeOffset(StartedAt.AddMinutes(10)), ["StalledAt"] = new DateTimeOffset(StartedAt.AddMinutes(20)), ["AvgApiLatencyMs"] = 513.5, diff --git a/src/Backend/AutopilotMonitor.Functions/Services/SessionIndexFieldManifest.cs b/src/Backend/AutopilotMonitor.Functions/Services/SessionIndexFieldManifest.cs index f3e8bdf0..e7921fec 100644 --- a/src/Backend/AutopilotMonitor.Functions/Services/SessionIndexFieldManifest.cs +++ b/src/Backend/AutopilotMonitor.Functions/Services/SessionIndexFieldManifest.cs @@ -78,6 +78,7 @@ namespace AutopilotMonitor.Functions.Services "DiagnosticsBlobName", "DiagnosticsBlobDestination", "LastEventAt", + "LastIngestAt", "ResumedAt", "StalledAt", "AvgApiLatencyMs", diff --git a/src/Backend/AutopilotMonitor.Functions/Services/TableStorageService.Sessions.cs b/src/Backend/AutopilotMonitor.Functions/Services/TableStorageService.Sessions.cs index ffea48ed..8fc6872f 100644 --- a/src/Backend/AutopilotMonitor.Functions/Services/TableStorageService.Sessions.cs +++ b/src/Backend/AutopilotMonitor.Functions/Services/TableStorageService.Sessions.cs @@ -225,6 +225,13 @@ namespace AutopilotMonitor.Functions.Services if (lastEventAt.HasValue) indexEntity["LastEventAt"] = EnsureUtc(lastEventAt.Value); + // Server-frame ingest stamp (IncrementSessionEventCountAsync merges this on every + // batch, so the index already carries it) — must be in this superset or a + // StartedAt-shift full upsert drops it and index-served reads lose the field. + var lastIngestAt = sessionEntity.GetDateTimeOffset("LastIngestAt")?.UtcDateTime; + if (lastIngestAt.HasValue) + indexEntity["LastIngestAt"] = EnsureUtc(lastIngestAt.Value); + var resumedAt = sessionEntity.GetDateTimeOffset("ResumedAt")?.UtcDateTime; if (resumedAt.HasValue) indexEntity["ResumedAt"] = EnsureUtc(resumedAt.Value);