Hello, we are using Grafana 10.4, and
I have a general question about a use-case we have. We have a table panel that we would like to create in grafana, where we have columns (from pg data source) benchmark_name
, metric_value
, profile_file
, revision
and a timestamp
in the form you can see in the screenshot.
The profile_files
are different for each benchmark_name
, so that’s why you can see in the screenshot that we created a time series to load it as a label to be used by data links later on in the final result.
Then, we’ve done some join operations for some other queries to also get additional information such as revision
.The percentages you can see in the desired result is the difference between the original-… and project-… benchmarks. We can gather these percentages directly with a SQL statement (instead of metric_values
). However, if that’s the case then we cannot use a “Prepare Time Series” transformation to append labels such as profile_file
’s to the final result (as metric then becomes a string), for data links. So the question is:
-
Is there any other way than having to prepare a time series to create labels?
-
Otherwise, is there any way to take a difference percentage between different columns and replace the original column to also display that information — without having to add a new field —?
-
Otherwise, is there a way to concat&reduce fields as a part of a transformation?
welcome to forum @mertanilhasret
could you please provide DDL and DML for the pg tables involved in this? You might be able to leverage pg sql and leave grafana to do what it does best: visualization
DDL
create table foo(benchmark_name char(50), metric_value int,
profile_file char(50), revision int, timestamp datetime)
DML
insert into foo
select 'bm-01', 33.3, 'sdkjsdkjskd', 2.0, '2025-08-28`
I try to avoid transformations etc at all cost unless the datasource itself cannot do what I need
We have the following table involved in this @yosiasz;
CREATE TABLE benchmark_results(
--id INT PRIMARY KEY,
benchmark_name VARCHAR(100),
profile_file VARCHAR(255),
metric_value NUMERIC(15,6),
timestamp BIGINT,
revision BIGINT
);
INSERT INTO benchmark_results VALUES ('bm_01', 'bm_01.svg', 42.0, 1756481439, 1);
INSERT INTO benchmark_results VALUES ('bm_02', 'bm_02.svg', 43.0, 1756481439, 1);
INSERT INTO benchmark_results VALUES ('bm_01', 'bm_01.svg', 45.0, 1756481450, 2);
INSERT INTO benchmark_results VALUES ('bm_02', 'bm_02.svg', 47.0, 1756481450, 2);
I agree that we should have grafana do the visualization only. Hence, I created a corresponding function that can calculate the difference between the metric values of different revisions of the same benchmarks, and append a new field to the returned query results wherever needed e.g. metric_value_display: ‘45.0 (+3.5%)‘, metric_value: 45.0.
However, the transformations need to be kept as far as I understood. Because I need to append profile_file into the labels of the columns, to be able to create a data link. And as far as I can see, there is no way to have labels without using time series transformation on the data…
1 Like
thanks. so for the given data
benchmark_name profile_file metric_value timestamp revision
bm_01 bm_01.svg 42.000000 1756481439 1
bm_02 bm_02.svg 43.000000 1756481439 1
bm_01 bm_01.svg 45.000000 1756481450 2
bm_02 bm_02.svg 47.000000 1756481450 2
What should the final result look like? You have described very well what you have actually implemented, but that might lead us off to another track. So it would help if you could describe to us what the final result you want would look like, without any grafana level implementation, but just your requirement in plain English or an image.