I've been trying to create a stacked bar chart in Grafana from Prometheus data but struggling and to be honest, I'm not even entirely sure that what I'm trying to do is possible. I've had a go using the old graph panel and the new bar chart panel - but to be honest I'm finding the new bar chart panel fairly unintuitive and documentation is vague. I'm working with a time-series counter for nginx requests split by response code. A sample of the data in Prometheus is:
nginx_vts_server_requests_total{code="2xx", host="example.com", instance="localhost:443", job="nginx_vts"}
I was hoping to create a stacked chart based on the number of requests from the last 12 hours, taking the last value of:
increase(nginx_vts_server_requests_total[12h])
I haven't included an aggregate as I'm only working with a single instance.
I am hoping to create something similar to the this image (mocked up in excel):
If anyone has created such a chart before in Grafana based on Prometheus data, I'd be very grateful if you could show me how it's done (if it is in fact possible at all). The screenshot at the top of the page at https://grafana.com/docs/grafana/latest/visualizations/bar-chart/ suggests that it is possible to do such groupings although this example is not stacked.