<p>I'm testing out HPA with custom metrics from application and exposing to K8s using Prometheus-adapter.</p>
<p>My app exposes a &quot;jobs_executing&quot; custom metric that is a numerical valued guage (prometheus-client) in golang exposing number of jobs executed by the app (pod).</p>
<p>Now to cater this in hpa, here is how my HPA configuration looks like:</p>
<pre><code>apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: myapp
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: myapp
  minReplicas: 1
  maxReplicas: 10
  metrics:
  - type: Pods
    pods:
      metric:
        name: jobs_executing
      target:
        type: AverageValue
        averageValue: 5
</code></pre>
<p>I want autoscaler to scale my pod when the average no. of jobs executed by overall pods equals &quot;5&quot;. This works, but sometimes the HPA configuration shows values like this:</p>
<pre><code>NAME             REFERENCE                           TARGETS   MINPODS   MAXPODS   REPLICAS   AGE
my-autoscaler    Deployment/my-scaling-sample-app    7700m/5     1         10        10       38m
</code></pre>
<p>here targets show up as &quot;7700m/5&quot; even though the average no. of jobs executed overall were 7.7. This makes HPA just scale horizontally aggressively. I don't understand why it is putting &quot;7700m&quot; in the current target value&quot;?</p>
<p>My question is, if there is a way to define a flaoting point here in HPA that doesn't confuse a normal integer with a 7700m (CPU unit?)</p>
<p>or what am I missing? Thank you</p>

Ahsan Nasir
<p>From the docs:</p>
<p><a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#appendix-quantities" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#appendix-quantities</a></p>
<blockquote>
<p>All metrics in the HorizontalPodAutoscaler and metrics APIs are specified using a special whole-number notation known in Kubernetes as a quantity. For example, the quantity 10500m would be written as 10.5 in decimal notation. The metrics APIs will return whole numbers without a suffix when possible, and will generally return quantities in milli-units otherwise. This means you might see your metric value fluctuate between 1 and 1500m, or 1 and 1.5 when written in decimal notation.</p>
</blockquote>
<p>So it does not seem like you are able to adjust the unit of measurement that the HPA uses, the generic Quantity.</p>
