diff --git a/src/DurableTask.AzureStorage/AnalyticsEventSource.cs b/src/DurableTask.AzureStorage/AnalyticsEventSource.cs index 5f04c0bca..38b6b2ba6 100644 --- a/src/DurableTask.AzureStorage/AnalyticsEventSource.cs +++ b/src/DurableTask.AzureStorage/AnalyticsEventSource.cs @@ -306,7 +306,7 @@ public void PoisonMessageDetected( ExtensionVersion); } - [Event(EventIds.FetchedInstanceHistory, Level = EventLevel.Informational, Version = 4)] + [Event(EventIds.FetchedInstanceHistory, Level = EventLevel.Informational, Version = 5)] public void FetchedInstanceHistory( string Account, string TaskHub, @@ -318,6 +318,7 @@ public void FetchedInstanceHistory( long LatencyMs, string ETag, DateTime LastCheckpointTime, + string LatestEvents, string AppName, string ExtensionVersion) { @@ -333,6 +334,7 @@ public void FetchedInstanceHistory( LatencyMs, ETag ?? string.Empty, LastCheckpointTime, + LatestEvents, AppName, ExtensionVersion); } diff --git a/src/DurableTask.AzureStorage/Logging/LogEvents.cs b/src/DurableTask.AzureStorage/Logging/LogEvents.cs index 0d9f91214..cd63f405a 100644 --- a/src/DurableTask.AzureStorage/Logging/LogEvents.cs +++ b/src/DurableTask.AzureStorage/Logging/LogEvents.cs @@ -745,7 +745,8 @@ public FetchedInstanceHistory( int requestCount, long latencyMs, string eTag, - DateTime lastCheckpointTime) + DateTime lastCheckpointTime, + string latestEvents) { this.Account = account; this.TaskHub = taskHub; @@ -757,6 +758,7 @@ public FetchedInstanceHistory( this.LatencyMs = latencyMs; this.ETag = eTag; this.LastCheckpointTime = lastCheckpointTime; + this.LatestEvents = latestEvents; } [StructuredLogField] @@ -789,6 +791,9 @@ public FetchedInstanceHistory( [StructuredLogField] public DateTime LastCheckpointTime { get; } + [StructuredLogField] + public string LatestEvents { get; } + public override EventId EventId => new EventId( EventIds.FetchedInstanceHistory, nameof(EventIds.FetchedInstanceHistory)); @@ -811,6 +816,7 @@ void IEventSourceEvent.WriteEventSource() => AnalyticsEventSource.Log.FetchedIns this.LatencyMs, this.ETag, this.LastCheckpointTime, + this.LatestEvents, Utils.AppName, Utils.ExtensionVersion); } diff --git a/src/DurableTask.AzureStorage/Logging/LogHelper.cs b/src/DurableTask.AzureStorage/Logging/LogHelper.cs index e8fe9438e..e4ecaae14 100644 --- a/src/DurableTask.AzureStorage/Logging/LogHelper.cs +++ b/src/DurableTask.AzureStorage/Logging/LogHelper.cs @@ -261,7 +261,8 @@ internal void FetchedInstanceHistory( int requestCount, long latencyMs, string eTag, - DateTime lastCheckpointTime) + DateTime lastCheckpointTime, + string latestEvents) { var logEvent = new LogEvents.FetchedInstanceHistory( account, @@ -273,7 +274,8 @@ internal void FetchedInstanceHistory( requestCount, latencyMs, eTag, - lastCheckpointTime); + lastCheckpointTime, + latestEvents); this.WriteStructuredLog(logEvent); } diff --git a/src/DurableTask.AzureStorage/Tracking/AzureTableTrackingStore.cs b/src/DurableTask.AzureStorage/Tracking/AzureTableTrackingStore.cs index 586207d02..6cecb9d66 100644 --- a/src/DurableTask.AzureStorage/Tracking/AzureTableTrackingStore.cs +++ b/src/DurableTask.AzureStorage/Tracking/AzureTableTrackingStore.cs @@ -14,7 +14,6 @@ namespace DurableTask.AzureStorage.Tracking { using System; - using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Linq; @@ -226,7 +225,8 @@ public override async Task GetHistoryEventsAsync(string in results.RequestCount, results.ElapsedMilliseconds, eTagValue?.ToString(), - checkpointCompletionTime); + checkpointCompletionTime, + string.Join(",", historyEvents.Skip(Math.Max(0, historyEvents.Count - 10)).Select(e => e.EventType.ToString()))); return new OrchestrationHistory(historyEvents, checkpointCompletionTime, eTagValue, trackingStoreContext); } @@ -264,7 +264,8 @@ async Task> QueryHistoryAsync(string filter, string i results.RequestCount, results.ElapsedMilliseconds, eTag: string.Empty, - DateTime.MinValue); + DateTime.MinValue, + string.Join(",", entities.Skip(Math.Max(0, entities.Count - 10)).Select(e => e.GetString(nameof(HistoryEvent.EventType))))); return entities; }