prometheusgrafanaspring-micrometer

Micrometer counter into Grafana chart


Hi I have the counter that increments with the tags job.id and processing.status

Counter counter = Counter.builder("ri.procession.job.count")
                                .tag("job.id", String.valueOf(jobId))
                                .tag("processing.status", item.getProcessingStatus().toString())
                                .tag("processing.start", String.valueOf(startTime.toEpochSecond(ZoneOffset.UTC)))
                                .register(meterRegistry);
                        counter.increment();

Prometheus selects the right values (as I hope) enter image description here

What I'd like to do is to display multi-dimensional series first grouped by job_id and then processing_status The result in Grafana should be looking similar to this enter image description here

I think that the problem is in data preparation because as I understood, they should look like

job_id SUCCESS FAILED_UNKNOWN
7300 15 10
7302 4 6
7304 3 3
7306 3

But I can't figure out how to achieve that. I've tried multiple "transform data in Grafana" but Im still not getting what I want

The closest was "Bar gauge" was this. But I was not able to separate the bars by job_id. enter image description here


Solution

  • As @markalex pointed out in comments, using bar chart: Panel: Bar chart. Then under query, Format: Time series, Type: Instant. Transformation: Join by labels (Value: processing_status, Join: job_id)

    is the solution. Thanks!