<p>I have following autoscaler configuration:</p>

<pre><code>apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
  name: pubsub
spec:
  minReplicas: 1
  maxReplicas: 5
  metrics:
  - external:
      metricName: pubsub.googleapis.com|subscription|num_undelivered_messages
      metricSelector:
        matchLabels:
          resource.labels.subscription_id: my-subscription-name
      targetAverageValue: "2"
    type: External
</code></pre>

<p>when I start my aplication I see following log event:</p>

<pre><code>unable to get external metric my-namespace/pubsub.googleapis.com|subscription|num_undelivered_messages/&amp;LabelSelector{MatchLabels:map[string]string{},MatchExpressions:[{resource.labels.subscription_id In [my-subscription]}],}: unable to fetch metrics from external metrics API: googleapi: Error 400: Field filter had an invalid value of "metric.type = "pubsub.googleapis.com/subscription/num_undelivered_messages" AND resource.labels.subscription_id = one_of("my-subscription")": Illegal function invocation in one_of(my-subscription); expected at least 2 arguments to one_of but got 1, badRequest
</code></pre>

<p>What could be wrong ? How correct it ?</p>

<p>P.S.
It worked 2 days ago</p>

gstackoverflow
<p>It is became working after I added <code>resource.type</code></p>

<pre><code> metricSelector:
          matchLabels:
            resource.labels.subscription_id: my-subscription-name
            resource.type: pubsub_subscription
</code></pre>

<p>looks like something was changed on GCP side</p>
