Skip to content

Commit 729774e

Browse files
committed
[EventHubs] Replacing scaling logs to WebJobs extension methods
1 parent 724366b commit 729774e

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
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/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Listeners/EventHubMetricsProvider.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Azure.Messaging.EventHubs;
1010
using Azure.Messaging.EventHubs.Primitives;
1111
using Microsoft.Azure.WebJobs.EventHubs.Listeners;
12+
using Microsoft.Azure.WebJobs.Host.Scale;
1213
using Microsoft.Extensions.Logging;
1314

1415
namespace Microsoft.Azure.WebJobs.Extensions.EventHubs.Listeners
@@ -102,7 +103,7 @@ public async Task<EventHubsTriggerMetrics> GetMetricsAsync()
102103
}
103104
catch (Exception e)
104105
{
105-
_logger.LogWarning($"Encountered an exception while getting partition information for Event Hub '{_client.EventHubName}' used for scaling. Error: {e.Message}");
106+
_logger.LogFunctionScaleWarning($"Encountered an exception while getting partition information for Event Hub '{_client.EventHubName}' used for scaling.", _functionId, e);
106107
}
107108

108109
// Get checkpoints
@@ -149,7 +150,7 @@ public async Task<EventHubsTriggerMetrics> GetMetricsAsync()
149150
}
150151
catch (Exception e)
151152
{
152-
_logger.LogWarning($"Encountered an exception while getting checkpoints for Event Hub '{_client.EventHubName}' used for scaling. Error: {e.Message}");
153+
_logger.LogFunctionScaleWarning($"Encountered an exception while getting checkpoints for Event Hub '{_client.EventHubName}' used for scaling.", _functionId, e);
153154
}
154155

155156
return CreateTriggerMetrics(partitionPropertiesTasks.Select(t => t.Result).ToList(), checkpoints);

sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Listeners/EventHubsTargetScaler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,13 @@ internal TargetScalerResult GetScaleResultInternal(TargetScalerContext context,
103103
int[] sortedValidWorkerCounts = GetSortedValidWorkerCountsForPartitionCount(partitionCount);
104104
int validatedTargetWorkerCount = GetValidWorkerCount(desiredWorkerCount, sortedValidWorkerCounts);
105105

106+
string details = $"Target worker count for function '{_functionId}' is '{validatedTargetWorkerCount}' (EventHubName='{_client.EventHubName}', EventCount ='{eventCount}', Concurrency='{desiredConcurrency}', PartitionCount='{partitionCount}').";
106107
if (validatedTargetWorkerCount != desiredWorkerCount)
107108
{
108-
_logger.LogInformation($"Desired target worker count of '{desiredWorkerCount}' is not in list of valid sorted workers: '{string.Join(",", sortedValidWorkerCounts)}'. Using next largest valid worker as target worker count.");
109+
details += $" Desired target worker count of '{desiredWorkerCount}' is not in list of valid sorted workers: '{string.Join(",", sortedValidWorkerCounts)}'. Using next largest valid worker as target worker count.";
109110
}
110111

111-
_logger.LogInformation($"Target worker count for function '{_functionId}' is '{validatedTargetWorkerCount}' (EventHubName='{_client.EventHubName}', EventCount ='{eventCount}', Concurrency='{desiredConcurrency}', PartitionCount='{partitionCount}').");
112+
_logger.LogFunctionScaleVote(_functionId, validatedTargetWorkerCount, (int)eventCount, desiredConcurrency, details);
112113

113114
return new TargetScalerResult
114115
{

0 commit comments

Comments
 (0)