-
Notifications
You must be signed in to change notification settings - Fork 275
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
Add target-based scaling support for Azure Storage #2452
Merged
Merged
Changes from 24 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
9faa500
initial commit
bachuv 64a5484
first draft TBS
davidmrdavid 9e56855
add no op scaler
davidmrdavid cd2ebe0
fix identation of dependency in csproj
davidmrdavid 841be56
add error message to no-op target scaler
davidmrdavid adbe80a
add private build suffix
davidmrdavid 5f79abe
change preview suffix
davidmrdavid 7bc0077
introduce more conditional compilation to pass smoke tests
davidmrdavid f534ce5
pass stylecop
davidmrdavid 0ad2d8e
add conditional compilation
davidmrdavid dc2c71a
patch conditional compilation exceptions
davidmrdavid 706aa00
add unit test
davidmrdavid 39b29d7
Merge branch 'main' of https://github.com/Azure/azure-functions-durab…
davidmrdavid 78f9490
Merge branch 'dev' of https://github.com/Azure/azure-functions-durabl…
davidmrdavid 70b6ebe
add comments
davidmrdavid bac5605
add unit tests
davidmrdavid 776e9b6
Update src/WebJobs.Extensions.DurableTask/AzureStorageDurabilityProvi…
davidmrdavid 22541c2
add logs and comments
davidmrdavid d94fa7f
Remove extra line
davidmrdavid 5da5ec4
Merge branch 'dev' into dajusto/tbs
davidmrdavid 4490d11
incorporate PR feedback
davidmrdavid c192695
remove DTFx.Listener improts
davidmrdavid 2e6a317
remove old GetPerformanceMonitor implementation
davidmrdavid e251a81
pass stylecop
davidmrdavid 7912e7a
add comments to explain when code runs in the ScaleController process
davidmrdavid 8d03b9a
pass stylecop
davidmrdavid 731d809
Add ScaleController V3 integration (#2462)
davidmrdavid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/WebJobs.Extensions.DurableTask/Listener/DurableTaskMetricsProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
#if !FUNCTIONS_V1 | ||
using System; | ||
using System.Threading.Tasks; | ||
using DurableTask.AzureStorage.Monitoring; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.WindowsAzure.Storage; | ||
using Newtonsoft.Json; | ||
|
||
namespace Microsoft.Azure.WebJobs.Extensions.DurableTask | ||
{ | ||
internal class DurableTaskMetricsProvider | ||
{ | ||
private readonly string functionName; | ||
private readonly string hubName; | ||
private readonly ILogger logger; | ||
private readonly CloudStorageAccount storageAccount; | ||
|
||
private DisconnectedPerformanceMonitor performanceMonitor; | ||
|
||
public DurableTaskMetricsProvider(string functionName, string hubName, ILogger logger, DisconnectedPerformanceMonitor performanceMonitor, CloudStorageAccount storageAccount) | ||
{ | ||
this.functionName = functionName; | ||
this.hubName = hubName; | ||
this.logger = logger; | ||
this.performanceMonitor = performanceMonitor; | ||
this.storageAccount = storageAccount; | ||
} | ||
|
||
public virtual async Task<DurableTaskTriggerMetrics> 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(); | ||
} | ||
catch (StorageException e) | ||
{ | ||
this.logger.LogWarning("{details}. Function: {functionName}. HubName: {hubName}.", e.ToString(), this.functionName, this.hubName); | ||
} | ||
|
||
if (heartbeat != null) | ||
{ | ||
metrics.PartitionCount = heartbeat.PartitionCount; | ||
metrics.ControlQueueLengths = JsonConvert.SerializeObject(heartbeat.ControlQueueLengths); | ||
metrics.ControlQueueLatencies = JsonConvert.SerializeObject(heartbeat.ControlQueueLatencies); | ||
metrics.WorkItemQueueLength = heartbeat.WorkItemQueueLength; | ||
if (heartbeat.WorkItemQueueLatency > TimeSpan.Zero) | ||
{ | ||
metrics.WorkItemQueueLatency = heartbeat.WorkItemQueueLatency.ToString(); | ||
} | ||
} | ||
|
||
return metrics; | ||
} | ||
|
||
internal DisconnectedPerformanceMonitor GetPerformanceMonitor() | ||
{ | ||
if (this.performanceMonitor == null) | ||
cgillum marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
if (this.storageAccount == null) | ||
{ | ||
throw new ArgumentNullException(nameof(this.storageAccount)); | ||
} | ||
|
||
this.performanceMonitor = new DisconnectedPerformanceMonitor(this.storageAccount, this.hubName); | ||
} | ||
|
||
return this.performanceMonitor; | ||
} | ||
} | ||
} | ||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is the target-based scaling support still based on the old deprecated AS backend?