Skip to content
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

Updates for Durable SQL v0.7.0-alpha changes #197

Merged
merged 1 commit into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public static TimeSpan MaxAllowedExecutionTime
public const string DurableTaskStorageConnectionName = "azureStorageConnectionStringName";
public const string DurableTaskSqlConnectionName = "connectionStringName";
public const string DurableTaskStorageProvider = "storageProvider";
public const string DurableTaskMicrosoftSqlProviderType = "MicrosoftSQL";
public const string DurableTaskMicrosoftSqlProviderType = "mssql";
public const string MicrosoftSqlScaler = "mssql";
public const string DurableTask = "durableTask";
public const string Extensions = "extensions";
Expand Down
6 changes: 4 additions & 2 deletions Kudu.Core/Functions/KedaFunctionTriggerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ internal static bool TryGetDurableKedaTrigger(string hostJsonText, out ScaleTrig
string storageType = storageProviderConfig?["type"]?.ToString();

// Custom storage types are supported starting in Durable Functions v2.4.2
// Minimum required version of Microsoft.DurableTask.SqlServer.AzureFunctions is v0.7.0-alpha
if (string.Equals(storageType, Constants.DurableTaskMicrosoftSqlProviderType, StringComparison.OrdinalIgnoreCase))
{
scaleTrigger = new ScaleTrigger
Expand All @@ -208,8 +209,9 @@ internal static bool TryGetDurableKedaTrigger(string hostJsonText, out ScaleTrig
Type = Constants.MicrosoftSqlScaler,
Metadata = new Dictionary<string, string>
{
["query"] = "SELECT dt.GetScaleMetric()",
["targetValue"] = "1", // super-conservative default
// Durable SQL scaling: https://microsoft.github.io/durabletask-mssql/#/scaling?id=worker-auto-scale
["query"] = "SELECT dt.GetScaleRecommendation(10, 1)", // max 10 orchestrations and 1 activity per replica
["targetValue"] = "1",
["connectionStringFromEnv"] = storageProviderConfig?[Constants.DurableTaskSqlConnectionName]?.ToString(),
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void DurableFunctionApp()
using (var fileStream = File.OpenWrite(zipFilePath))
using (var archive = new ZipArchive(fileStream, ZipArchiveMode.Create, leaveOpen: true))
{
CreateJsonFileEntry(archive, "host.json", @"{""version"":""2.0"",""extensions"":{""durableTask"":{""hubName"":""DFTest"",""storageProvider"":{""type"":""MicrosoftSQL"",""connectionStringName"":""SQLDB_Connection""}}}}");
CreateJsonFileEntry(archive, "host.json", @"{""version"":""2.0"",""extensions"":{""durableTask"":{""hubName"":""DFTest"",""storageProvider"":{""type"":""mssql"",""connectionStringName"":""SQLDB_Connection""}}}}");
CreateJsonFileEntry(archive, "f1/function.json", @"{""bindings"":[{""type"":""orchestrationTrigger"",""name"":""context""}],""disabled"":false}");
CreateJsonFileEntry(archive, "f2/function.json", @"{""bindings"":[{""type"":""entityTrigger"",""name"":""ctx""}],""disabled"":false}");
CreateJsonFileEntry(archive, "f3/function.json", @"{""bindings"":[{""type"":""activityTrigger"",""name"":""input""}],""disabled"":false}");
Expand Down