Combine 4 metrics into 1 graph

  • What Grafana version and what operating system are you using?
    10.2.2
  • What are you trying to achieve?
    I want to have 1 overview for 4 metrics
    So i have 4 metrics success, failed, running, queued and they can be 1.
    So if success is 1 then the rest is 0
    If failed is 1 then the others are 0

I would like to create a stat overview with 1 stat representing one of the 4 metrics.

  • How are you trying to achieve it?
    I dont know that yet.
    I can do a promql giving me all the metrics == 1
    (airflow_dag_last_status{host=“lspe000763”,owner=“mca”})==1
    And then the status field can maybe be used to differentiate the stat
    For example
airflow_dag_last_status{dag_id="CORA",ddis="bla",env="acceptation",host="myhost",instance="10.251.101.246:8081",job="airflow_metrics",owner="mca",srvrole="airflow",status="failed"}
airflow_dag_last_status{dag_id="DORA",ddis="bla",env="acceptation",host="myhost",instance="10.251.101.246:8081",job="airflow_metrics",owner="mca",srvrole="airflow",status="success"}
  • What happened?
    I can not get it in stat as i want.
    When the status is succes i want stat to turn green.
    When it is failed i want it red.

  • What did you expect to happen?
    See above

  • Can you copy/paste the configuration(s) that you are having problems with?
    No

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No

  • Did you follow any online instructions? If so, what is the URL?
    N/A

I kinda made a workaround on it.
All metrics have either value 0 or 1 depending on the state.
By adding for example 24, 49, 99 i can differentiate the states.

For example:
((airflow_dag_last_status{host=“$host”,owner=“mca”,dag_id=“$flow”,status=“success”})==1)+99

If succes then this is 100
Then i use threshold an vlue mapping to make the dashboard with the Stat panel