Extend Azure Monitor scaler to support custom metrics #1883
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.
Add
metricNamespace
parameter to the Azure Monitor scaler to allow scaling based on custom metrics.When querying Custom metrics in Azure Monitor, the metric namespace must be provided in the API request. Otherwise, only default metrics can be found. E.g. for Azure Key Vault, when trying to get a custom metric without specifying the namespace, we will get the following error from the metrics client:
keda_metrics_adapter/provider "msg"="error getting metric for scaler" "error"="error getting azure monitor metric QueueDepth: insights.MetricsClient#List: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Failed to find metric configuration for provider: Microsoft.KeyVault, resource Type: vaults, metric: QueueDepth, Valid metrics: ServiceApiHit,ServiceApiLatency,ServiceApiResult,SaturationShoebox,Availability"" "scaledObject.Name"="nginx-scaler" "scaledObject.Namespace"="keda" "scaler"={}
Documentation update PR: kedacore/keda-docs#468
Partly fixes #1489 (I don't think it covers the Application Insights metrics)
Checklist
Signed-off-by: amirschw 24677563+amirschw@users.noreply.github.com