Skip to content

Commit 8f5e15d

Browse files
committed
[Storage] Replacing scaling logs to WebJobs extension methods
1 parent 724366b commit 8f5e15d

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

NuGet.Config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<clear />
55
<!-- Do not add any additional feeds if new packages are needed they need to come from our azure-sdk-for-net DevOps feed which has an upstream set to nuget.org -->
66
<add key="azure-sdk-for-net" value="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json" />
7+
<add key="local" value="Q:\nuget" />
78
</packageSources>
89
<disabledPackageSources>
910
<clear />

eng/Packages.Data.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@
249249
<PackageReference Update="Microsoft.Azure.SignalR.Management" Version="1.29.0" />
250250
<PackageReference Update="Microsoft.Azure.SignalR.Protocols" Version="1.29.0" />
251251
<PackageReference Update="Microsoft.Azure.SignalR.Serverless.Protocols" Version="1.10.0" />
252-
<PackageReference Update="Microsoft.Azure.WebJobs" Version="3.0.41" />
253-
<PackageReference Update="Microsoft.Azure.WebJobs.Sources" Version="3.0.41" PrivateAssets="All"/>
252+
<PackageReference Update="Microsoft.Azure.WebJobs" Version="3.0.42-dev" />
253+
<PackageReference Update="Microsoft.Azure.WebJobs.Sources" Version="3.0.42-dev" PrivateAssets="All"/>
254254
<PackageReference Update="Microsoft.Azure.WebJobs.Extensions.Rpc" Version="3.0.41" />
255255
<PackageReference Update="Microsoft.Azure.WebJobs.Host.Storage" Version="5.0.1" />
256256
<PackageReference Update="Microsoft.Spatial" Version="7.5.3" />

sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Common/src/Shared/Queues/QueueMetricsProvider.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Azure;
77
using Azure.Storage.Queues;
88
using Azure.Storage.Queues.Models;
9+
using Microsoft.Azure.WebJobs.Host.Scale;
910
using Microsoft.Extensions.Logging;
1011

1112
namespace Microsoft.Azure.WebJobs.Extensions.Storage.Common.Listeners
@@ -49,12 +50,12 @@ public async Task<int> GetQueueLengthAsync()
4950
// ignore transient errors, and return default metrics
5051
// E.g. if the queue doesn't exist, we'll return a zero queue length
5152
// and scale in
52-
_logger.LogWarning($"Error querying for queue scale status: {ex.ToString()}");
53+
_logger.LogFunctionScaleError("Error querying for queue scale status", string.Empty, ex);
5354
}
5455
}
5556
catch (Exception ex)
5657
{
57-
_logger.LogWarning($"Fatal error querying for queue scale status: {ex.ToString()}");
58+
_logger.LogFunctionScaleError("Fatal error querying for queue scale status", string.Empty, ex);
5859
}
5960

6061
return 0;
@@ -101,12 +102,13 @@ public async Task<QueueTriggerMetrics> GetMetricsAsync()
101102
// ignore transient errors, and return default metrics
102103
// E.g. if the queue doesn't exist, we'll return a zero queue length
103104
// and scale in
104-
_logger.LogWarning($"Error querying for queue scale status: {ex.ToString()}");
105+
106+
_logger.LogFunctionScaleError("Error querying for queue scale status", string.Empty, ex);
105107
}
106108
}
107109
catch (Exception ex)
108110
{
109-
_logger.LogWarning($"Fatal error querying for queue scale status: {ex.ToString()}");
111+
_logger.LogFunctionScaleError("Fatal error querying for queue scale status", string.Empty, ex);
110112
}
111113

112114
return new QueueTriggerMetrics

sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Common/src/Shared/Queues/QueueTargetScaler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ internal TargetScalerResult GetScaleResultInternal(TargetScalerContext context,
6464

6565
int targetWorkerCount = (int)Math.Ceiling(queueLength / (decimal)concurrency);
6666

67-
_logger.LogInformation($"Target worker count for function '{_functionId}' is '{targetWorkerCount}' (QueueName='{_queueName}', QueueLength ='{queueLength}', Concurrency='{concurrency}').");
67+
string details = $"Target worker count for function '{_functionId}' is '{targetWorkerCount}' (QueueName='{_queueName}', QueueLength ='{queueLength}', Concurrency='{concurrency}').";
68+
_logger.LogFunctionScaleVote(_functionId, targetWorkerCount, queueLength, concurrency, details);
6869
return new TargetScalerResult
6970
{
7071
TargetWorkerCount = targetWorkerCount

0 commit comments

Comments
 (0)