Stacked bar chart for prometheus

  • What Grafana version and what operating system are you using?
    9.5.3 deployed on k8s

  • What are you trying to achieve?
    image
    I am trying to have such chart. I got 6 metrics(say A_SUCCESS, A_FAIL, B_SUCCESS, B_FAIL, C_SUCCESS, C_FAIL) They are prometheus counters. I want have 3 bars A B and C. SUCCESS and FAIL are stacked like the graph shown.

  • How are you trying to achieve it?
    The metrics looks like
    sum(increase(A_SUCCESS{name="somename"}[$__range:10s] @ ${__to:date:seconds}))
    sum(increase(A_FAIL{name="somename"}[$__range:10s] @ ${__to:date:seconds}))


for a bar chart, I cannot get rid of the time series x axis. But I want x axis to be A B and C and y axis to be the value of sum(increase(A_FAIL{name="somename"}[$__range:10s] @ ${__to:date:seconds})) the query result.

For Bar Gauge,


But I did not see any stack option so I cannot the SUCCESS and FAIL stacked in one bar.

  • What happened?

  • What did you expect to happen?

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

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

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

The expected graph is from this discussion. The post seems have a SQL db but i am using prometheus