I am creating a real time dashboard from performance testing perspective that would fetch data from InfluxDB (mostly client side) and Prometheus (server side). It will have below panels (will look fancier in Grafana, of course).
Metric | Value | Weightage | Score | Final Score | Description |
---|---|---|---|---|---|
Error Percent | 8.9% | 1 | 2 | 2 | Score 1:<5%, Score 2:5-10%,Score 3 >10% |
Response Time | 2.5 s | 3 | 1 | 3 | Score 1:<3s, Score 2:3-6s,Score 3 >6s |
- Metric: Text Panel(Could be markdown or HTML)
- Value: Stat Panel (Will be calculated using queries)
- Weightage: Text Panel (User driven and it will have variable dropdown). Text panel will simply display the variable value selected by the user
- Score: Stat Panel (It will be value mapping of metric as per description and will point to value panel)
- Final Score: This will be the multiplication of weightage and score and this is my pain point at the moment.
I am struggling to do multiplication of a Grafana variable (as text) and the value mapping that is done on the query result.
Is there a way we can do math operations on Weightage and Score. Tried my hands with transform but no luck. Is there a better way to achieve this?
Thanks in advance.
Edit: Adding Queries and data returned from Prometheus and InfluxDB.
Below InfluxDB query returns Error% (Example: 4.56%)
SELECT sum("error") / sum("all")
FROM (
SELECT sum("count") AS "all"
FROM "$measurement_name"
WHERE "transaction" = 'all'
AND "application"=~ /^$application$/
AND $timeFilter
GROUP BY time($__interval) fill(null)
), (
SELECT sum("countError") AS "error"
FROM "$measurement_name"
WHERE "transaction" = 'all'
AND "application" =~ /^$application$/
AND $timeFilter
GROUP BY time($__interval) fill(null)
)
Below Prometheus query will return CPU Utilization % (For example- 52.5%)
sum(node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate{cluster="$cluster", namespace="$namespace"}) / sum(kube_pod_container_resource_requests{job="kube-state-metrics", cluster="$cluster", namespace="$namespace", resource="cpu"})