|
13 | 13 | #nullable enable |
14 | 14 | namespace DurableTask.Core.Logging |
15 | 15 | { |
16 | | - using System; |
17 | | - using System.Collections.Generic; |
18 | | - using System.Text; |
19 | 16 | using DurableTask.Core.Command; |
| 17 | + using DurableTask.Core.Common; |
| 18 | + using DurableTask.Core.Entities.EventFormat; |
20 | 19 | using DurableTask.Core.Entities.OperationFormat; |
21 | 20 | using DurableTask.Core.History; |
22 | 21 | using Microsoft.Extensions.Logging; |
| 22 | + using System; |
| 23 | + using System.Collections.Generic; |
| 24 | + using System.Text; |
23 | 25 |
|
24 | 26 | class LogHelper |
25 | 27 | { |
@@ -745,6 +747,42 @@ internal void RenewActivityMessageFailed(TaskActivityWorkItem workItem, Exceptio |
745 | 747 | this.WriteStructuredLog(new LogEvents.RenewActivityMessageFailed(workItem, exception), exception); |
746 | 748 | } |
747 | 749 | } |
| 750 | + |
| 751 | + /// <summary> |
| 752 | + /// Logs that a "poison message" has been detected and is being dropped. |
| 753 | + /// </summary> |
| 754 | + /// <param name="orchestrationInstance">The orchestration instance this event was sent to.</param> |
| 755 | + /// <param name="historyEvent">The "poisoned" event.</param> |
| 756 | + /// <param name="details">Extra details related to the processing of this poison message.</param> |
| 757 | + internal void PoisonMessageDetected(OrchestrationInstance? orchestrationInstance, HistoryEvent historyEvent, string details) |
| 758 | + { |
| 759 | + if (this.IsStructuredLoggingEnabled) |
| 760 | + { |
| 761 | + this.WriteStructuredLog(new LogEvents.PoisonMessageDetected( |
| 762 | + orchestrationInstance, |
| 763 | + historyEvent.EventType.ToString(), |
| 764 | + Utils.GetTaskEventId(historyEvent).ToString(), |
| 765 | + details)); |
| 766 | + } |
| 767 | + } |
| 768 | + |
| 769 | + /// <summary> |
| 770 | + /// Logs that a "poison" entity request message has been detected and is being dropped. |
| 771 | + /// </summary> |
| 772 | + /// <param name="orchestrationInstance">The orchestration instance this event was sent to.</param> |
| 773 | + /// <param name="requestMessage">The "poisoned" reuest message.</param> |
| 774 | + /// <param name="details">Extra details related to the processing of this poison message.</param> |
| 775 | + internal void PoisonMessageDetected(OrchestrationInstance orchestrationInstance, RequestMessage requestMessage, string details) |
| 776 | + { |
| 777 | + if (this.IsStructuredLoggingEnabled) |
| 778 | + { |
| 779 | + this.WriteStructuredLog(new LogEvents.PoisonMessageDetected( |
| 780 | + orchestrationInstance, |
| 781 | + requestMessage.IsLockRequest ? "LockRequest" : "OperationRequest", |
| 782 | + requestMessage.Id.ToString(), |
| 783 | + details)); |
| 784 | + } |
| 785 | + } |
748 | 786 | #endregion |
749 | 787 |
|
750 | 788 | internal void OrchestrationDebugTrace(string instanceId, string executionId, string details) |
|
0 commit comments