argoproj-labs / argocd-extension-metrics

An Argo CD extension to enable visualization of metrics in Argo CD UI.
Apache License 2.0
111 stars 25 forks source link

Not able to do maths on the query expression #72

Open Tchoupinax opened 5 months ago

Tchoupinax commented 5 months ago

Hey!

I tested to improve the default dashboard by customized prometheus query and I'm surprised that it does not work with the ArgoCD extension while it works directly with Prometheus.

sum(rate(container_memory_usage_bytes{pod=~\"{{ "{{" }}.name{{ "}}" }}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}[5m])) by (pod)/1000/1000"

For instance, I want to display the memory usage in megabytes (so we divide by 10^6). However, it continues to display the metrics in bytes in argoCD Could you help me to know why it does not work?

Thank you!

eduardomsec commented 1 month ago

Hey!

Try this

round(sum(container_memory_usage_bytes{pod=~\"{{.name}}\", container!=\"POD\", image!=\"\", container!=\"\", container_name!=\"POD\"}) by (pod) / 1024 / 1024, 0.01)