Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/DurableTask.AzureStorage/AnalyticsEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace DurableTask.AzureStorage
{
using System;
using System.Collections.Specialized;
using System.Diagnostics.Tracing;
using System.Runtime.CompilerServices;
using DurableTask.AzureStorage.Logging;
Expand Down Expand Up @@ -507,11 +508,12 @@ public void PendingOrchestratorMessageLimitReached(
ExtensionVersion);
}

[Event(EventIds.WaitingForMoreMessages, Level = EventLevel.Informational, Version = 2)]
[Event(EventIds.WaitingForMoreMessages, Level = EventLevel.Informational, Version = 3)]
public void WaitingForMoreMessages(
string Account,
string TaskHub,
string PartitionId,
string Details,
string AppName,
string ExtensionVersion)
{
Expand All @@ -520,6 +522,7 @@ public void WaitingForMoreMessages(
Account,
TaskHub,
PartitionId,
Details,
AppName,
ExtensionVersion);
}
Expand Down
5 changes: 5 additions & 0 deletions src/DurableTask.AzureStorage/BackoffPollingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public void Reset()
this.resetEvent.Set();
}

public TimeSpan GetCurrentDelay()
{
return this.backoffStrategy.CurrentInterval;
}

public async Task<bool> WaitAsync(CancellationToken hostCancellationToken)
{
bool signaled = await this.resetEvent.WaitAsync(this.backoffStrategy.CurrentInterval, hostCancellationToken);
Expand Down
10 changes: 8 additions & 2 deletions src/DurableTask.AzureStorage/Logging/LogEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1266,11 +1266,13 @@ internal class WaitingForMoreMessages : StructuredLogEvent, IEventSourceEvent
public WaitingForMoreMessages(
string account,
string taskHub,
string partitionId)
string partitionId,
string details)
{
this.Account = account;
this.TaskHub = taskHub;
this.PartitionId = partitionId;
this.Details = details;
}

[StructuredLogField]
Expand All @@ -1282,19 +1284,23 @@ public WaitingForMoreMessages(
[StructuredLogField]
public string PartitionId { get; }

[StructuredLogField]
public string Details { get; }

public override EventId EventId => new EventId(
EventIds.WaitingForMoreMessages,
nameof(EventIds.WaitingForMoreMessages));

public override LogLevel Level => LogLevel.Information;

protected override string CreateLogMessage() =>
$"{this.PartitionId}: No new messages were found - backing off";
$"{this.PartitionId}: No new messages were found - backing off. Details: ${this.Details}";

void IEventSourceEvent.WriteEventSource() => AnalyticsEventSource.Log.WaitingForMoreMessages(
this.Account,
this.TaskHub,
this.PartitionId,
this.Details,
Utils.AppName,
Utils.ExtensionVersion);
}
Expand Down
6 changes: 4 additions & 2 deletions src/DurableTask.AzureStorage/Logging/LogHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,14 @@ internal void PendingOrchestratorMessageLimitReached(
internal void WaitingForMoreMessages(
string account,
string taskHub,
string partitionId)
string partitionId,
string details)
{
var logEvent = new LogEvents.WaitingForMoreMessages(
account,
taskHub,
partitionId);
partitionId,
details);
this.WriteStructuredLog(logEvent);
}

Expand Down
3 changes: 2 additions & 1 deletion src/DurableTask.AzureStorage/Messaging/ControlQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ public async Task<IReadOnlyList<MessageData>> GetMessagesAsync(CancellationToken
this.settings.Logger.WaitingForMoreMessages(
this.storageAccountName,
this.settings.TaskHubName,
this.storageQueue.Name);
this.storageQueue.Name,
$"Backoff is {this.backoffHelper.GetCurrentDelay().TotalMilliseconds} ms");
}

await this.backoffHelper.WaitAsync(linkedCts.Token);
Expand Down