diff --git a/src/WebJobs.Extensions.DurableTask/DurableTaskJobHostConfigurationExtensions.cs b/src/WebJobs.Extensions.DurableTask/DurableTaskJobHostConfigurationExtensions.cs index fdc925fbd..2ae182cc9 100644 --- a/src/WebJobs.Extensions.DurableTask/DurableTaskJobHostConfigurationExtensions.cs +++ b/src/WebJobs.Extensions.DurableTask/DurableTaskJobHostConfigurationExtensions.cs @@ -126,7 +126,9 @@ internal static IWebJobsBuilder AddDurableScaleForTrigger(this IWebJobsBuilder b provider = new DurableTaskTriggersScaleProvider(serviceProvider.GetService>(), serviceProvider.GetService(), serviceProvider.GetService(), serviceProvider.GetService>(), triggerMetadata); return provider; }); - builder.Services.AddSingleton(serviceProvider => serviceProvider.GetServices().Single(x => x == provider)); + + // Commenting out incremental scale model for hotfix release 3.0.0-rc.4, SC uses TBS by default + // builder.Services.AddSingleton(serviceProvider => serviceProvider.GetServices().Single(x => x == provider)); builder.Services.AddSingleton(serviceProvider => serviceProvider.GetServices().Single(x => x == provider)); return builder; } diff --git a/src/WebJobs.Extensions.DurableTask/Listener/DurableTaskMetricsProvider.cs b/src/WebJobs.Extensions.DurableTask/Listener/DurableTaskMetricsProvider.cs index 0aff5fc1c..940823778 100644 --- a/src/WebJobs.Extensions.DurableTask/Listener/DurableTaskMetricsProvider.cs +++ b/src/WebJobs.Extensions.DurableTask/Listener/DurableTaskMetricsProvider.cs @@ -17,6 +17,8 @@ internal class DurableTaskMetricsProvider private readonly string hubName; private readonly ILogger logger; private readonly StorageAccountClientProvider storageAccountClientProvider; + private PerformanceHeartbeat heartbeat; + private DateTime heartbeatTimeStamp; private DisconnectedPerformanceMonitor performanceMonitor; @@ -30,6 +32,8 @@ public DurableTaskMetricsProvider( this.logger = logger; this.performanceMonitor = performanceMonitor; this.storageAccountClientProvider = storageAccountClientProvider; + this.heartbeat = null; + this.heartbeatTimeStamp = DateTime.MinValue; } public virtual async Task GetMetricsAsync() @@ -37,18 +41,23 @@ public virtual async Task GetMetricsAsync() DurableTaskTriggerMetrics metrics = new DurableTaskTriggerMetrics(); // Durable stores its own metrics, so we just collect them here - PerformanceHeartbeat heartbeat = null; try { DisconnectedPerformanceMonitor performanceMonitor = this.GetPerformanceMonitor(); - heartbeat = await performanceMonitor.PulseAsync(); + + // We only want to call PulseAsync every 5 seconds + if (this.heartbeat == null || DateTime.UtcNow > this.heartbeatTimeStamp.AddSeconds(5)) + { + this.heartbeat = await performanceMonitor.PulseAsync(); + this.heartbeatTimeStamp = DateTime.UtcNow; + } } catch (Exception e) when (e.InnerException is RequestFailedException) { this.logger.LogWarning("{details}. HubName: {hubName}.", e.ToString(), this.hubName); } - if (heartbeat != null) + if (this.heartbeat != null) { metrics.PartitionCount = heartbeat.PartitionCount; metrics.ControlQueueLengths = JsonConvert.SerializeObject(heartbeat.ControlQueueLengths); diff --git a/src/WebJobs.Extensions.DurableTask/WebJobs.Extensions.DurableTask.csproj b/src/WebJobs.Extensions.DurableTask/WebJobs.Extensions.DurableTask.csproj index 210fceffb..3d8a5d68e 100644 --- a/src/WebJobs.Extensions.DurableTask/WebJobs.Extensions.DurableTask.csproj +++ b/src/WebJobs.Extensions.DurableTask/WebJobs.Extensions.DurableTask.csproj @@ -8,7 +8,7 @@ 0 0 $(MajorVersion).$(MinorVersion).$(PatchVersion) - rc.4 + rc.5 $(MajorVersion).$(MinorVersion).$(PatchVersion) $(MajorVersion).0.0.0 Microsoft Corporation