-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
New Solace Direct Messaging Scaler #6546
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Alfonso Chacón <[email protected]>
Signed-off-by: Alfonso Chacón <[email protected]>
Signed-off-by: Alfonso Chacón <[email protected]>
Signed-off-by: Alfonso Chacón <[email protected]>
Signed-off-by: Alfonso Chacón <[email protected]>
Signed-off-by: Alfonso Chacón <[email protected]>
…scarded messages while scaling up Signed-off-by: Alfonso Chacón <[email protected]>
- Added Configuration validations - Variables Refactor - Multiple URLs - Remove commented blocks Signed-off-by: Alfonso Chacón <[email protected]>
Signed-off-by: Alfonso Chacón <[email protected]>
Signed-off-by: Alfonso Chacón <[email protected]>
Signed-off-by: alfonso-chacon <[email protected]>
Signed-off-by: Alfonso Chacón <[email protected]>
* Code Cleanup - CodeQL/StaticChecks
Signed-off-by: Alfonso Chacón <[email protected]>
* Code cleanup /golangci-lint
Signed-off-by: Alfonso Chacón <[email protected]>
Signed-off-by: Alfonso Chacón <[email protected]>
return meta, nil | ||
} | ||
|
||
// Interface required method!! |
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.
// Interface required method!! |
if s.configuration.AggregatedClientTxByteRateTarget > 0 { | ||
metricName := kedautil.NormalizeString(fmt.Sprintf("solace-dm-%s-%s", clientNamePattern, aggregatedClientTxByteRateTargetMetricName)) | ||
externalMetric := &v2.ExternalMetricSource{ | ||
Metric: v2.MetricIdentifier{ | ||
Name: GenerateMetricNameWithIndex(triggerIndex, metricName), | ||
}, | ||
Target: GetMetricTarget(s.metricType, s.configuration.AggregatedClientTxByteRateTarget), | ||
} | ||
metricSpec := v2.MetricSpec{External: externalMetric, Type: solaceDMExternalMetricType} | ||
metricSpecList = append(metricSpecList, metricSpec) | ||
} | ||
// | ||
// Target Client AverageTxByteRate | ||
if s.configuration.AggregatedClientAverageTxByteRateTarget > 0 { | ||
metricName := kedautil.NormalizeString(fmt.Sprintf("solace-dm-%s-%s", clientNamePattern, aggregatedClientAverageTxByteRateTargetMetricName)) | ||
externalMetric := &v2.ExternalMetricSource{ | ||
Metric: v2.MetricIdentifier{ | ||
Name: GenerateMetricNameWithIndex(triggerIndex, metricName), | ||
}, | ||
Target: GetMetricTarget(s.metricType, s.configuration.AggregatedClientAverageTxByteRateTarget), | ||
} | ||
metricSpec := v2.MetricSpec{External: externalMetric, Type: solaceDMExternalMetricType} | ||
metricSpecList = append(metricSpecList, metricSpec) | ||
} | ||
// | ||
// Target Client TxMsgRate | ||
if s.configuration.AggregatedClientTxMsgRateTarget > 0 { | ||
metricName := kedautil.NormalizeString(fmt.Sprintf("solace-dm-%s-%s", clientNamePattern, aggregatedClientTxMsgRateTargetMetricName)) | ||
externalMetric := &v2.ExternalMetricSource{ | ||
Metric: v2.MetricIdentifier{ | ||
Name: GenerateMetricNameWithIndex(triggerIndex, metricName), | ||
}, | ||
Target: GetMetricTarget(s.metricType, s.configuration.AggregatedClientTxMsgRateTarget), | ||
} | ||
metricSpec := v2.MetricSpec{External: externalMetric, Type: solaceDMExternalMetricType} | ||
metricSpecList = append(metricSpecList, metricSpec) | ||
} | ||
// | ||
// Target Client AverageTxMsgRate | ||
if s.configuration.AggregatedClientAverageTxMsgRateTarget > 0 { | ||
metricName := kedautil.NormalizeString(fmt.Sprintf("solace-dm-%s-%s", clientNamePattern, aggregatedClientAverageTxMsgRateTargetMetricName)) | ||
externalMetric := &v2.ExternalMetricSource{ | ||
Metric: v2.MetricIdentifier{ | ||
Name: GenerateMetricNameWithIndex(triggerIndex, metricName), | ||
}, | ||
Target: GetMetricTarget(s.metricType, s.configuration.AggregatedClientAverageTxMsgRateTarget), | ||
} | ||
metricSpec := v2.MetricSpec{External: externalMetric, Type: solaceDMExternalMetricType} | ||
metricSpecList = append(metricSpecList, metricSpec) | ||
} | ||
|
||
return metricSpecList |
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.
Let's unify this code just calculating the metricName and the value for the target with the ifs and unifying the other code:
if s.configuration.AggregatedClientTxByteRateTarget > 0 { | |
metricName := kedautil.NormalizeString(fmt.Sprintf("solace-dm-%s-%s", clientNamePattern, aggregatedClientTxByteRateTargetMetricName)) | |
externalMetric := &v2.ExternalMetricSource{ | |
Metric: v2.MetricIdentifier{ | |
Name: GenerateMetricNameWithIndex(triggerIndex, metricName), | |
}, | |
Target: GetMetricTarget(s.metricType, s.configuration.AggregatedClientTxByteRateTarget), | |
} | |
metricSpec := v2.MetricSpec{External: externalMetric, Type: solaceDMExternalMetricType} | |
metricSpecList = append(metricSpecList, metricSpec) | |
} | |
// | |
// Target Client AverageTxByteRate | |
if s.configuration.AggregatedClientAverageTxByteRateTarget > 0 { | |
metricName := kedautil.NormalizeString(fmt.Sprintf("solace-dm-%s-%s", clientNamePattern, aggregatedClientAverageTxByteRateTargetMetricName)) | |
externalMetric := &v2.ExternalMetricSource{ | |
Metric: v2.MetricIdentifier{ | |
Name: GenerateMetricNameWithIndex(triggerIndex, metricName), | |
}, | |
Target: GetMetricTarget(s.metricType, s.configuration.AggregatedClientAverageTxByteRateTarget), | |
} | |
metricSpec := v2.MetricSpec{External: externalMetric, Type: solaceDMExternalMetricType} | |
metricSpecList = append(metricSpecList, metricSpec) | |
} | |
// | |
// Target Client TxMsgRate | |
if s.configuration.AggregatedClientTxMsgRateTarget > 0 { | |
metricName := kedautil.NormalizeString(fmt.Sprintf("solace-dm-%s-%s", clientNamePattern, aggregatedClientTxMsgRateTargetMetricName)) | |
externalMetric := &v2.ExternalMetricSource{ | |
Metric: v2.MetricIdentifier{ | |
Name: GenerateMetricNameWithIndex(triggerIndex, metricName), | |
}, | |
Target: GetMetricTarget(s.metricType, s.configuration.AggregatedClientTxMsgRateTarget), | |
} | |
metricSpec := v2.MetricSpec{External: externalMetric, Type: solaceDMExternalMetricType} | |
metricSpecList = append(metricSpecList, metricSpec) | |
} | |
// | |
// Target Client AverageTxMsgRate | |
if s.configuration.AggregatedClientAverageTxMsgRateTarget > 0 { | |
metricName := kedautil.NormalizeString(fmt.Sprintf("solace-dm-%s-%s", clientNamePattern, aggregatedClientAverageTxMsgRateTargetMetricName)) | |
externalMetric := &v2.ExternalMetricSource{ | |
Metric: v2.MetricIdentifier{ | |
Name: GenerateMetricNameWithIndex(triggerIndex, metricName), | |
}, | |
Target: GetMetricTarget(s.metricType, s.configuration.AggregatedClientAverageTxMsgRateTarget), | |
} | |
metricSpec := v2.MetricSpec{External: externalMetric, Type: solaceDMExternalMetricType} | |
metricSpecList = append(metricSpecList, metricSpec) | |
} | |
return metricSpecList | |
metricName := "" | |
target := 1 | |
if s.configuration.AggregatedClientTxByteRateTarget > 0 { | |
metricName : kedautil.NormalizeString(fmt.Sprintf("solace-dm-%s-%s", clientNamePattern, aggregatedClientTxByteRateTargetMetricName)) | |
target = s.configuration.AggregatedClientTxByteRateTarget | |
} | |
// | |
// Target Client AverageTxByteRate | |
if s.configuration.AggregatedClientAverageTxByteRateTarget > 0 { | |
metricName = kedautil.NormalizeString(fmt.Sprintf("solace-dm-%s-%s", clientNamePattern, aggregatedClientAverageTxByteRateTargetMetricName)) | |
target = s.configuration.AggregatedClientAverageTxByteRateTarget | |
} | |
// | |
// Target Client TxMsgRate | |
if s.configuration.AggregatedClientTxMsgRateTarget > 0 { | |
metricName = kedautil.NormalizeString(fmt.Sprintf("solace-dm-%s-%s", clientNamePattern, aggregatedClientTxMsgRateTargetMetricName)) | |
target = s.configuration.AggregatedClientTxMsgRateTarget | |
} | |
// | |
// Target Client AverageTxMsgRate | |
if s.configuration.AggregatedClientAverageTxMsgRateTarget > 0 { | |
metricName = kedautil.NormalizeString(fmt.Sprintf("solace-dm-%s-%s", clientNamePattern, aggregatedClientAverageTxMsgRateTargetMetricName)) | |
target = s.configuration.AggregatedClientAverageTxMsgRateTarget | |
} | |
externalMetric := &v2.ExternalMetricSource{ | |
Metric: v2.MetricIdentifier{ | |
Name: GenerateMetricNameWithIndex(triggerIndex, metricName), | |
}, | |
Target: GetMetricTarget(s.metricType, target), | |
} | |
metricSpec := v2.MetricSpec{External: externalMetric, Type: solaceDMExternalMetricType} | |
metricSpecList = append(metricSpecList, metricSpec) | |
return metricSpecList |
return metricSpecList | ||
} | ||
|
||
// Interface required method!! |
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.
// Interface required method!! |
return []external_metrics.ExternalMetricValue{}, false, err | ||
} | ||
|
||
s.logger.Info(fmt.Sprintf("Metrics: '%s'", metricValues)) |
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.
let's move to debug
s.logger.Info(fmt.Sprintf("Metrics: '%s'", metricValues)) | |
s.logger.V(1).Info(fmt.Sprintf("Metrics: '%s'", metricValues)) |
return []external_metrics.ExternalMetricValue{metric}, true, nil | ||
} | ||
|
||
// Interface required method!! |
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.
// Interface required method!! |
/run-e2e solace_dm |
New Solace Direct Messaging Scaler Added
Checklist
Fixes #
Relates to #
[#6545] (#6545) - Issue
[#1537] (kedacore/keda-docs#1537) - Documentation