-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[Storage] Replacing scaling logs to WebJobs extension methods #53923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -249,8 +249,8 @@ | |||||||||
| <PackageReference Update="Microsoft.Azure.SignalR.Management" Version="1.29.0" /> | ||||||||||
| <PackageReference Update="Microsoft.Azure.SignalR.Protocols" Version="1.29.0" /> | ||||||||||
| <PackageReference Update="Microsoft.Azure.SignalR.Serverless.Protocols" Version="1.10.0" /> | ||||||||||
| <PackageReference Update="Microsoft.Azure.WebJobs" Version="3.0.41" /> | ||||||||||
| <PackageReference Update="Microsoft.Azure.WebJobs.Sources" Version="3.0.41" PrivateAssets="All"/> | ||||||||||
| <PackageReference Update="Microsoft.Azure.WebJobs" Version="3.0.42-dev" /> | ||||||||||
| <PackageReference Update="Microsoft.Azure.WebJobs.Sources" Version="3.0.42-dev" PrivateAssets="All"/> | ||||||||||
|
Comment on lines
+252
to
+253
|
||||||||||
| <PackageReference Update="Microsoft.Azure.WebJobs" Version="3.0.42-dev" /> | |
| <PackageReference Update="Microsoft.Azure.WebJobs.Sources" Version="3.0.42-dev" PrivateAssets="All"/> | |
| <PackageReference Update="Microsoft.Azure.WebJobs" Version="3.0.42" /> | |
| <PackageReference Update="Microsoft.Azure.WebJobs.Sources" Version="3.0.42" PrivateAssets="All"/> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| using Azure; | ||
| using Azure.Storage.Queues; | ||
| using Azure.Storage.Queues.Models; | ||
| using Microsoft.Azure.WebJobs.Host.Scale; | ||
| using Microsoft.Extensions.Logging; | ||
|
|
||
| namespace Microsoft.Azure.WebJobs.Extensions.Storage.Common.Listeners | ||
|
|
@@ -15,16 +16,19 @@ namespace Microsoft.Azure.WebJobs.Extensions.Storage.Common.Listeners | |
| /// </summary> | ||
| internal class QueueMetricsProvider | ||
| { | ||
| private readonly string _functionId; | ||
| private readonly QueueClient _queue; | ||
| private readonly ILogger _logger; | ||
|
|
||
| /// <summary> | ||
| /// Instantiates a QueueMetricsProvider. | ||
| /// </summary> | ||
| /// <param name="functionId">The function id to make scale decisions for.</param> | ||
| /// <param name="queue">The QueueClient to use for metrics polling.</param> | ||
| /// <param name="loggerFactory">Used to create an ILogger instance.</param> | ||
| public QueueMetricsProvider(QueueClient queue, ILoggerFactory loggerFactory) | ||
| public QueueMetricsProvider(string functionId, QueueClient queue, ILoggerFactory loggerFactory) | ||
| { | ||
| _functionId = functionId; | ||
| _queue = queue; | ||
| _logger = loggerFactory.CreateLogger<QueueMetricsProvider>(); | ||
| } | ||
|
|
@@ -49,12 +53,12 @@ public async Task<int> GetQueueLengthAsync() | |
| // ignore transient errors, and return default metrics | ||
| // E.g. if the queue doesn't exist, we'll return a zero queue length | ||
| // and scale in | ||
| _logger.LogWarning($"Error querying for queue scale status: {ex.ToString()}"); | ||
| _logger.LogFunctionScaleWarning("Error querying for queue scale status", _functionId, ex); | ||
| } | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| _logger.LogWarning($"Fatal error querying for queue scale status: {ex.ToString()}"); | ||
| _logger.LogFunctionScaleWarning("Fatal error querying for queue scale status", _functionId, ex); | ||
| } | ||
|
|
||
| return 0; | ||
|
|
@@ -101,12 +105,13 @@ public async Task<QueueTriggerMetrics> GetMetricsAsync() | |
| // ignore transient errors, and return default metrics | ||
| // E.g. if the queue doesn't exist, we'll return a zero queue length | ||
| // and scale in | ||
| _logger.LogWarning($"Error querying for queue scale status: {ex.ToString()}"); | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: looks like you included an extraneous space here? |
||
| _logger.LogFunctionScaleWarning("Error querying for queue scale status", _functionId, ex); | ||
| } | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| _logger.LogWarning($"Fatal error querying for queue scale status: {ex.ToString()}"); | ||
| _logger.LogFunctionScaleWarning("Fatal error querying for queue scale status", _functionId, ex); | ||
| } | ||
|
|
||
| return new QueueTriggerMetrics | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A local package source
Q:\nugethas been added to the NuGet configuration. This appears to be a development-specific path that should not be committed to the repository.Please remove this line before merging, as it will not work for other developers and could cause build issues in CI/CD pipelines.