Skip to content

Commit be2e16a

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

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public async Task<EventHubsTriggerMetrics> GetMetricsAsync()
102102
}
103103
catch (Exception e)
104104
{
105-
_logger.LogWarning($"Encountered an exception while getting partition information for Event Hub '{_client.EventHubName}' used for scaling. Error: {e.Message}");
105+
_logger.LogFunctionScaleError($"Encountered an exception while getting partition information for Event Hub '{_client.EventHubName}' used for scaling.", _functionId, e);
106106
}
107107

108108
// Get checkpoints
@@ -149,7 +149,7 @@ public async Task<EventHubsTriggerMetrics> GetMetricsAsync()
149149
}
150150
catch (Exception e)
151151
{
152-
_logger.LogWarning($"Encountered an exception while getting checkpoints for Event Hub '{_client.EventHubName}' used for scaling. Error: {e.Message}");
152+
_logger.LogFunctionScaleError($"Encountered an exception while getting checkpoints for Event Hub '{_client.EventHubName}' used for scaling.", _functionId, e);
153153
}
154154

155155
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)