GoogleCloudPlatform / k8s-stackdriver

Apache License 2.0
390 stars 211 forks source link

Stackdriver metrics are not supported by HorizontalPodAutoscaler #489

Open red8888 opened 1 year ago

red8888 commented 1 year ago

Following best practices I created my custom SD metric named this: "custom/custom.googleapis.com/mymetric" https://cloud.google.com/monitoring/api/v3/naming-conventions

I tried to use it in HorizontalPodAutoscaler.autoscaling.

That generated this error: spec.metrics[0].pods.metric.name: Invalid value: "custom/custom.googleapis.com/srfw_ready_count": may not contain '/'

Am I doing something wrong?

red8888 commented 1 year ago

Looks like I have this issue: https://github.com/GoogleCloudPlatform/k8s-stackdriver/issues/198

I just installed the metrics adapter last week so should have latest.

Do I define the metric name in HPA settings like this: "custom|custom.googleapis.com|mymetric"? I then GKE is smart enough to find the stackdriver metric named: "custom/custom.googleapis.com/mymetric"?

Why isn't this documented? https://cloud.google.com/kubernetes-engine/docs/tutorials/autoscaling-metrics#step4

OR do I just leave off "custom/custom.googleapis.com" entirely and just do mymetric ?

CatherineF-dev commented 7 months ago

Hi, you can use mymetric or custom.googleapis.com|mymetric