This use case focuses on converting PostgreSQL metric data—specifically Allocation
, Utilization
, and Utilization %
values—into a clean, comparative table format in Grafana using transformations. The raw data is fetched via three separate SQL queries (one for each metric type) from the metrics
table. Each query filters based on metric_type
, and the results are categorized by category
(A, B, C).
Follow these step to achive requirement.
Step 1 : Create table and insert data in it. In my case I used postgresql to store data.
CREATE TABLE metrics (
id SERIAL PRIMARY KEY,
category VARCHAR(1) NOT NULL, – e.g., A, B, C
metric_type VARCHAR(20) NOT NULL, – e.g., Allocation, Utilization
value NUMERIC(10, 2) NOT NULL – Numeric value with two decimal places
);
Step 2: Select table Visualizations to display data on grafana panel.
Step 3: Now write queries to fetch data in my case 3 different query used to fetch data.
• Click on Add query for multiple query fetch according to your requirement.
- Query A
- Query B
- Query C
Step 4: Now apply transformations to visualized the data on table.
- Merge series/tables
- Transpose
Final output