From 4a0e2ee128da2d0850ed6de000694e5ae221b3e7 Mon Sep 17 00:00:00 2001 From: Ying Liu Date: Wed, 24 Aug 2022 15:32:35 +0800 Subject: [PATCH] enhance azure data explorer scaler metric name with trigger.metadata.metricName --- pkg/scalers/azure_data_explorer_scaler.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/scalers/azure_data_explorer_scaler.go b/pkg/scalers/azure_data_explorer_scaler.go index 77570a48123..f58a009c803 100644 --- a/pkg/scalers/azure_data_explorer_scaler.go +++ b/pkg/scalers/azure_data_explorer_scaler.go @@ -118,7 +118,13 @@ func parseAzureDataExplorerMetadata(config *ScalerConfig, logger logr.Logger) (* } // Generate metricName. - metadata.MetricName = GenerateMetricNameWithIndex(config.ScalerIndex, kedautil.NormalizeString(fmt.Sprintf("%s-%s", adxName, metadata.DatabaseName))) + metadataName, _ := getParameterFromConfig(config, "metricName", false) + if err != nil { + // metadataName is not defined + metadata.MetricName = GenerateMetricNameWithIndex(config.ScalerIndex, kedautil.NormalizeString(fmt.Sprintf("%s-%s", adxName, metadata.DatabaseName))) + } else { + metadata.MetricName = GenerateMetricNameWithIndex(config.ScalerIndex, kedautil.NormalizeString(fmt.Sprintf("%s-%s-%s", adxName, metadata.DatabaseName, metadataName))) + } activeDirectoryEndpoint, err := azure.ParseActiveDirectoryEndpoint(config.TriggerMetadata) if err != nil {