Skip to content

Upgrading from KEDA 2.5.0 to 2.7.0 with external scaler #3032

Closed
@miaooss

Description

Report

We are using au external scaler
Keda seems to be connecting to the service correctly.

But some expected metrics or metadata are missing

Here is our KEDA configuration:

  scalingStrategy:
    strategy: "accurate"                        # Optional. Default: default. Which Scaling Strategy to use.
  triggers:
    - type: external
      metadata:
        scalerAddress: servicename.<env>:3009
        service: servicename
       

This is the C# code we are using


    public async override Task<GetMetricSpecResponse> GetMetricSpec(ScaledObjectRef request, ServerCallContext context)
    {
        var resp = new GetMetricSpecResponse();

        if (request.ScalerMetadata.TryGetValue("service", out string serviceValue) && serviceValue == "servicename")
        {
            resp.MetricSpecs.Add(new MetricSpec
            {
                MetricName = "targetAverageValue",
                TargetSize = 1
            });
        }

        return await Task.FromResult(resp);
    }
    
    
    public override async Task<GetMetricsResponse> GetMetrics(GetMetricsRequest request, ServerCallContext context)
    {
        var resp = new GetMetricsResponse();

        if (request.ScalerMetadata.TryGetValue("service", out string serviceValue) && serviceValue == "servicename")
        {
            if (request.MetricName == "queueLength")
            {
                long pendingJobsCount = await GetPendingJobsCount();
                resp.MetricValues.Add(new MetricValue
                {
                    MetricName = "queueLength",
                    MetricValue_ = pendingJobsCount
                });
            }
        }

        return resp;
    }

Expected Behavior

Expect KEDA to scale up the service

Actual Behavior

We do return no actual job.

Steps to Reproduce the Problem

  1. We update KEDA version to use 2.7.0
  2. We can tell that the old version is working fine 2.5.0

Logs from KEDA operator

1.6522127784315143e+09  INFO    scaleexecutor   Scaling Jobs    {"scaledJob.Name": "servicename", "scaledJob.Namespace": "dev", "Number of running Jobs": 0}

KEDA Version

2.7.0

Kubernetes Version

1.23

Platform

Microsoft Azure

Scaler Details

External

Anything else?

No response

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions