Skip to content

Commit

Permalink
add label to net hpa metric
Browse files Browse the repository at this point in the history
  • Loading branch information
randytqwjp committed Sep 27, 2024
1 parent 5219656 commit 9017e62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/hpa/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ func (c *Service) ChangeHPAFromTortoiseRecommendation(tortoise *autoscalingv1bet
if netChangeMaxReplicas < 0 || netChangeMinReplicas > 0 {
metrics.DecreaseApplyCounter.WithLabelValues(tortoise.Name, tortoise.Namespace).Add(1)
}
metrics.NetHPAMinReplicas.WithLabelValues(tortoise.Name, tortoise.Namespace, hpa.Name).Set(netChangeMinReplicas)
metrics.NetHPAMaxReplicas.WithLabelValues(tortoise.Name, tortoise.Namespace, hpa.Name).Set(netChangeMaxReplicas)
metrics.NetHPAMinReplicas.WithLabelValues(tortoise.Name, tortoise.Namespace, hpa.Name, tortoise.Spec.TargetRefs.ScaleTargetRef.Name).Set(netChangeMinReplicas)
metrics.NetHPAMaxReplicas.WithLabelValues(tortoise.Name, tortoise.Namespace, hpa.Name, tortoise.Spec.TargetRefs.ScaleTargetRef.Name).Set(netChangeMaxReplicas)
metrics.AppliedHPAMinReplicas.WithLabelValues(tortoise.Name, tortoise.Namespace, hpa.Name).Set(float64(*hpa.Spec.MinReplicas))
metrics.AppliedHPAMaxReplicas.WithLabelValues(tortoise.Name, tortoise.Namespace, hpa.Name).Set(float64(hpa.Spec.MaxReplicas))
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ var (
NetHPAMinReplicas = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "net_hpa_minreplicas",
Help: "net hpa minReplicas that tortoises actually applys to hpa",
}, []string{"tortoise_name", "namespace", "hpa_name"})
}, []string{"tortoise_name", "namespace", "hpa_name", "kube_deployment"})

NetHPAMaxReplicas = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "net_hpa_maxreplicas",
Help: "net hpa maxReplicas that tortoises actually applys to hpa",
}, []string{"tortoise_name", "namespace", "hpa_name"})
}, []string{"tortoise_name", "namespace", "hpa_name", "kube_deployment"})

NetCPURequest = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "net_cpu_request",
Expand Down

0 comments on commit 9017e62

Please sign in to comment.