Add scaler api for consumption plan support#963
Conversation
|
@AmeyaRele We've already started the release process for our GA Trigger release - is this something that should be included as a part of that? Or is it ok to follow up with later on? Also, is there any documentation you could link to with more context about what this feature is as well? |
|
@Charles-Gagnon we can follow up with this later on. It isn't a criteria for GA of trigger afaik. I don't believe there is public documentation on this, but essentially the scale component is redesigned to use these methods by including the extension as a package and use reflection to call the method in the scale component. This is required in consumption(scale to zero) plan for azure functions as the scale component is not guaranteed to have a worker running which it can query for the scaling decisions. |
|
Hi @AmeyaRele, just curious how much more work is needed in this PR. Is it just the tests, or is there other known work that needs to go in product code-wise? |
|
It's just the tests, the changes are done. Need a review on this PR from scale controller team |
Charles-Gagnon
left a comment
There was a problem hiding this comment.
Are you going to be adding tests as well? Especially integration tests, is that something that we're going to be able to do?
| string connectionString = SqlBindingUtilities.GetConnectionString(sqlMetadata.ConnectionStringSetting, config); | ||
| int maxChangesPerWorker = config.GetValue(SqlTriggerConstants.ConfigKey_SqlTrigger_MaxChangesPerWorker, SqlOptions.DefaultMaxChangesPerWorker); | ||
| string userDefinedLeasesTableName = sqlMetadata.LeasesTableName; | ||
| string userFunctionId = (string)triggerMetadata.Properties["userFunctionId"]; |
There was a problem hiding this comment.
Are we guaranteed that this is going to have a value? Is there a reason you're not able to use the same method we use for getting the function ID elsewhere?
There was a problem hiding this comment.
Why don't we use triggerMetadata.FunctionName here?
There was a problem hiding this comment.
@Charles-Gagnon we can't really reuse the function ID from the SqlTriggerBinding, can I replace it with triggerMetadata.FunctionName mentioned above?
There was a problem hiding this comment.
Why aren't we able to use the same method? Do we not have access to IHostIdProvider ?
If not, then I believe we're still going to need to find another since we still will need to get the function ID somehow in order for the metrics provider to be able to get the list of unprocessed changes : https://github.com/Azure/azure-functions-sql-extension/blob/main/src/TriggerBinding/SqlTriggerMetricsProvider.cs#L103
There was a problem hiding this comment.
the userFunctionId is gotten from HostIdProvider, and it would use this to
https://github.com/Azure/azure-functions-host/blob/47411dfdc56bedd7f7dd20aa487fe69dbc596325/src/WebJobs.Script/Host/ScriptHostIdProvider.cs#L49
I saw that the scalecontroller also had a hostid which I thought I could use, but the values might be different, as it is using a different class namely FixedHostIdProvider please confirm @alrod
We could go ahead and use triggerMetadata.FunctionName but we would have to use the same at places where userFunctionId is used, in order to get unprocessed changes, as Charles has mentioned.
|
There are merge conflicts, please merge main. Please confirm with Alexey on using the hostId and we can have a discussion on getting userFunctionId. |
|
@Charles-Gagnon please review again |
* Add scaler api for consumption plan support * Make scale method internal * Add test, resolve comments * Add packages for test * Fix test * Read from both appsettings and options * Modify trigger listener params in test * Fix indent --------- Co-authored-by: MaddyDev <madhu.koripalli@gmail.com>
Description
This PR adds scaler apis for supporting SQL extension on Azure Functions Consumption Plan. The TargetScaler and ScaleMonitor would be called from scale controller by including the sql package.
Task List
Reference PRs