datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

Kubernetes dd-agent hpa scaling with sqs queues

Open ghost opened this issue 6 years ago • 3 comments

Im trying to integrate datadog agent on kubernetes to use hpa to scale on SQS queue. i tried doing the following, but it seem this approach doesn't work :

----> apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: name: hpascalingsqs spec: minReplicas: 1 maxReplicas: 10 scaleTargetRef: apiVersion: apps/v1beta1 kind: Deployment name: hpascalingsqs-dev-chart metrics: - type: External external: metricName: aws.sqs.approximate_number_of_messages_visible metricSelector: matchLabels: queuename: hpascalingsqs targetAverageValue: 1

--->

error:

Type Reason Age From Message


Warning FailedGetExternalMetric 2m6s (x295 over 77m) horizontal-pod-autoscaler unable to get external metric dev/aws.sqs.approximate_number_of_messages_visible/&LabelSelector{MatchLabels:map[string]string{queuename: essence-extraction-service-dc-cluster-queue-alt,},MatchExpressions:[],}: no metrics returned from external metrics API

ghost avatar Jun 01 '20 20:06 ghost

Hey @rahsaanpage-nbcuni

The metric you want to scale on is an AWS metric. This metric is most likely coming in with a delay (because it comes from our crawlers) and you will need to tweak the cluster agent a bit so it can evaluate it correctly.

From the list of env vars: https://docs.datadoghq.com/agent/cluster_agent/commands/#cluster-agent-options you can use:

  • DD_EXTERNAL_METRICS_PROVIDER_BUCKET_SIZE: Size of the window (in seconds) used to query metrics from Datadog. Defaults to 300 seconds.
  • DD_EXTERNAL_METRICS_PROVIDER_MAX_AGE: Maximum age (in seconds) of a datapoint before considering it invalid to be served. Default to 120 seconds.

If this does not yield any good results, please open a support ticket by emailing: [email protected] to troubleshoot this further with our support team.

Simon

Simwar avatar Jun 08 '20 15:06 Simwar

the Team and i was able to resolve the issue, it had nothing to do with the env var. it was a permission issue in the yaml file that was deployed

ghost avatar Jul 06 '20 15:07 ghost

what was the permissions issue we are facing this same issue? @rahsaanpage-nbcuni

travis-jorge avatar May 12 '22 16:05 travis-jorge