public override Task <GetMetricSpecResponse> GetMetricSpec(ScaledObjectRef request, ServerCallContext context) { var resp = new GetMetricSpecResponse(); resp.MetricSpecs.Add(new MetricSpec { MetricName = "earthquakeThreshold", TargetSize = 10 }); return(Task.FromResult(resp)); }
public override Task <GetMetricSpecResponse> GetMetricSpec(ScaledObjectRef request, ServerCallContext context) { var metricsSpec = new MetricSpec(); metricsSpec.MetricName = "kaboom"; metricsSpec.TargetSize = 1; var response = new GetMetricSpecResponse(); response.MetricSpecs.Add(metricsSpec); return(Task.FromResult <GetMetricSpecResponse>(response)); }
// GetMetricsSpec is for constructing the HPA object. If the ScaledObject changes KEDA needs to change the HPA too. // This method is usually called after New, it also depends on the ScaledObject metadata sent to New before, e.g. Target. public override Task <GetMetricSpecResponse> GetMetricSpec(ScaledObjectRef scaledObject, ServerCallContext context) { var metricSpecResponse = new GetMetricSpecResponse(); _logger.LogInformation($"GetMetricSpec: _targetSize: {_targetSize}"); metricSpecResponse.MetricSpecs.Add(new MetricSpec() { MetricName = "mymetric", //If this scaler handles more than one metric, then this changes. In our case it doesn't. TargetSize = _targetSize }); return(Task.FromResult(metricSpecResponse)); }
public override Task <GetMetricSpecResponse> GetMetricSpec(ScaledObjectRef request, ServerCallContext context) { _logger.LogInformation($"Namespace: {request?.Namespace} DeploymentName: {request?.Name} GetMetricSpec() called."); var response = new GetMetricSpecResponse(); var fields = new RepeatedField <MetricSpec>(); fields.Add(new MetricSpec() { MetricName = ScaleRecommendation, TargetSize = 1 * MLTIPLICITY }); response.MetricSpecs.Add(fields); return(Task.FromResult(response)); }