Table Panel: Convert two metrics into a single table

Hello,
I can’t get my head wrapped around the table structure and options.

I have two metrics in Prometheus. They both have the same label that correspond to a specific object. I’m trying to design a table that displays three columns: The value of each label, the size and the count.

Here’s a small scale, simplified data set for each metric.

Data set 1
---------------------------------
some_size{container="size-mon" job="abc/size-mon", namespace="abc", some_name="name-1"} 14609
some_size{container="size-mon" job="abc/size-mon", namespace="abc", some_name="name-2"} 17576
some_size{container="size-mon" job="abc/size-mon", namespace="abc", some_name="name-3"} 27112
some_size{container="size-mon" job="abc/size-mon", namespace="abc", some_name="name-4"} 0
some_size{container="size-mon" job="abc/size-mon", namespace="abc", some_name="name-5"} 49335
some_size{container="size-mon" job="abc/size-mon", namespace="abc", some_name="name-6"} 4197
some_size{container="size-mon" job="abc/size-mon", namespace="abc", some_name="name-7"} 42399
some_size{container="size-mon" job="abc/size-mon", namespace="abc", some_name="name-8"} 45849
some_size{container="size-mon" job="abc/size-mon", namespace="abc", some_name="name-9"} 2303

Data set 2
---------------------------------
some_count{container="count-mon" job="abc/count-mon", namespace="abc", some_name="name-1"} 4609
some_count{container="count-mon" job="abc/count-mon", namespace="abc", some_name="name-2"} 7876
some_count{container="count-mon" job="abc/count-mon", namespace="abc", some_name="name-3"} 112
some_count{container="count-mon" job="abc/count-mon", namespace="abc", some_name="name-4"} 0
some_count{container="count-mon" job="abc/count-mon", namespace="abc", some_name="name-5"} 935
some_count{container="count-mon" job="abc/count-mon", namespace="abc", some_name="name-6"} 397
some_count{container="count-mon" job="abc/count-mon", namespace="abc", some_name="name-7"} 419
some_count{container="count-mon" job="abc/count-mon", namespace="abc", some_name="name-8"} 384
some_count{container="count-mon" job="abc/count-mon", namespace="abc", some_name="name-9"} 8420

And I want to display the data like this:

+-----------+-----------+------------+
| some_name | some_size | some_count |
+-----------+-----------+------------+
| name-1    | 14609     | 4609       |
+-----------+-----------+------------+
| name-2    | 17576     | 7876       |
+-----------+-----------+------------+
| name-3    | 27112     | 112        |
+-----------+-----------+------------+
| name-4    | 0         | 0          |
+-----------+-----------+------------+
| name-5    | 49335     | 935        |
+-----------+-----------+------------+
| name-6    | 4197      | 397        |
+-----------+-----------+------------+
| name-7    | 42399     | 419        |
+-----------+-----------+------------+
| name-8    | 45849     | 384        |
+-----------+-----------+------------+
| name-9    | 2303      | 8420       |
+-----------+-----------+------------+

My questions are:

  1. How to query two metrics into a name, size, count structure?
  2. How to display it in the above table?

Thank you very much :pray:

1 Like

Thanks! This helped me greatly :slight_smile:

1 Like