amazon-archives / k8s-cloudwatch-adapter

An implementation of Kubernetes Custom Metrics API for Amazon CloudWatch
Apache License 2.0
158 stars 98 forks source link

External metrics API: ValidationError #2

Closed rahultib10 closed 5 years ago

rahultib10 commented 5 years ago

$ kubectl describe hpa Name: sqs-consumer-scaler Namespace: default Labels: Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"autoscaling/v2beta1","kind":"HorizontalPodAutoscaler","metadata":{"annotations":{},"name":"sqs-consumer-scaler","namespace":"default"},"... CreationTimestamp: Sat, 18 May 2019 14:27:20 +0530 Reference: Deployment/sqs-consumer Metrics: ( current / target ) "sqs-helloworld-length" (target value): / 30 Min replicas: 1 Max replicas: 10 Conditions: Type Status Reason Message


AbleToScale True SucceededGetScale the HPA controller was able to get the target's current scale ScalingActive False FailedGetExternalMetric the HPA was unable to compute the replica count: unable to get external metric default/sqs-helloworld-length/nil: unable to fetch metrics from external metrics API: ValidationError: The value sqs-helloworld-length for parameter MetricDataQueries.member.1.Id is not matching the expected pattern ^[a-z][a-zA-Z0-9_]*$.

status code: 400, request id: fae93972-794a-11e9-a10c-29b005d2c12b** Events: Type Reason Age From Message


Warning FailedGetExternalMetric 5s horizontal-pod-autoscaler unable to get external metric default/sqs-helloworld-length/nil: unable to fetch metrics from external metrics API: ValidationError: The value sqs-helloworld-length for parameter MetricDataQueries.member.1.Id is not matching the expected pattern ^[a-z][a-zA-Z0-9_]*$.

rahultib10 commented 5 years ago

This is fixed by removing the hyphen(-) in the id parameter, so Maintainers please update those code like ` queries:

to

` queries: