GoogleCloudPlatform / k8s-stackdriver

Apache License 2.0
391 stars 212 forks source link

Allow custom metrics from a different pod #504

Open clarkmcc opened 1 year ago

clarkmcc commented 1 year ago

I have two deployments, where one should be scaled based on a metric from the other deployment, the problem is that the custom-metrics-stackdriver-adapter attaches pod name when it queries the monitoring API. This prevents me from using metrics from any pod, except the pod I'm trying to auto-scale.

I0203 18:07:49.909309 1 filter_builder.go:258] Query with filter(s): "metric.labels.pod = \"analyzer-54bb4ff4dc-hnzn5\" AND metric.type = \"prometheus.googleapis.com/"...

Is there a workaround?

tomarsnap commented 1 year ago

I think I had a similar issue using the type Pods metric. I got this working with the external metrics like so:

metrics:
  - type: External
    external:
      metric:
        name: prometheus.googleapis.com|jobs|gauge
      target:
        type: AverageValue
        averageValue: 1
piotrgrohs commented 1 year ago

its not working on me if i try to use extenral type metrics. Prometheus.googleapis not found.

CatherineF-dev commented 9 months ago

cc @piotrgrohs do you have google-managed-prometheus in your cluster?

Metrics collected by google-managed-prometheus will be sent into prometheus.googleapis.com