-
Notifications
You must be signed in to change notification settings - Fork 54
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 scaler api for consumption plan support #963
base: main
Are you sure you want to change the base?
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 |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we use triggerMetadata.FunctionName
here?
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.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
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