Hello, team! I would like to change below promql q...
# support
h
Hello, team! I would like to change below promql query to query builder. • rate(system_cpu_time{temporality="Cumulative",cpu="cpu11",host_name="signoz-host",os_type="linux",state="system"}[1m]) But I couldn't find how to set range vector selector([1m]) in query builder. I thought 'Aggregate Every' was a value, but the graph was made different from when I called PromQL.
Due to the company policy, I can not attach screenshots, so I upload request and response values that I checked in developer mode. PromQL • Request >
Copy code
{
>    "start":1720000800000,
>    "end":1720001460000,
>    "step":60,
>    "variables":{
>    },
>    "compositeQuery":{
>       "queryType":"promql",
>       "panelType":"graph",
>       "fillGaps":false,
>       "promQueries":{
>          "A":{
>             "name":"A",
>             "query":"rate(system_cpu_time{__temporality__=\"Cumulative\",cpu=\"cpu11\",host_name=\"signoz-host\",os_type=\"linux\",state=\"system\"}[1m])",
>             "legend":"",
>             "disabled":false
>          }
>       }
>    }
> }
• Response >
Copy code
{
>     "status": "success",
>     "data": {
>         "resultType": "",
>         "result": [
>             {
>                 "queryName": "A",
>                 "series": [
>                     {
>                         "labels": {
>                             "__temporality__": "Cumulative",
>                             "cpu": "cpu11",
>                             "host_name": "signoz-host",
>                             "os_type": "linux",
>                             "state": "system"
>                         },
>                         "labelsArray": null,
>                         "values": [
>                             {
>                                 "timestamp": 1720000800000,
>                                 "value": "0.022666666666433837"
>                             },
>                             {
>                                 "timestamp": 1720000860000,
>                                 "value": "0.01900000000023283"
>                             },
>                             {
>                                 "timestamp": 1720000920000,
>                                 "value": "0.020666666666511447"
>                             },
>                             {
>                                 "timestamp": 1720000980000,
>                                 "value": "0.026000866695517714"
>                             },
>                             {
>                                 "timestamp": 1720001040000,
>                                 "value": "0.026999999999922388"
>                             },
>                             {
>                                 "timestamp": 1720001100000,
>                                 "value": "0.025333333333643775"
>                             },
>                             {
>                                 "timestamp": 1720001160000,
>                                 "value": "0.03866666666678308"
>                             },
>                             {
>                                 "timestamp": 1720001220000,
>                                 "value": "0.022334077802535213"
>                             },
>                             {
>                                 "timestamp": 1720001280000,
>                                 "value": "0.020333333333352736"
>                             },
>                             {
>                                 "timestamp": 1720001340000,
>                                 "value": "0.02100000000015522"
>                             },
>                             {
>                                 "timestamp": 1720001400000,
>                                 "value": "0.017332755574464936"
>                             },
>                             {
>                                 "timestamp": 1720001460000,
>                                 "value": "0.025"
>                             }
>                         ]
>                     }
>                 ]
>             }
>         ]
>     }
> }
Query Builder • Request >
Copy code
{
>    "start":1720000800000,
>    "end":1720001460000,
>    "step":60,
>    "variables":{
>       
>    },
>    "compositeQuery":{
>       "queryType":"builder",
>       "panelType":"graph",
>       "fillGaps":false,
>       "builderQueries":{
>          "A":{
>             "dataSource":"metrics",
>             "queryName":"A",
>             "aggregateOperator":"rate",
>             "aggregateAttribute":{
>                "key":"system_cpu_time",
>                "dataType":"float64",
>                "type":"Sum",
>                "isColumn":true,
>                "isJSON":false,
>                "id":"system_cpu_time--float64--Sum--true"
>             },
>             "timeAggregation":"rate",
>             "spaceAggregation":"sum",
>             "functions":[
>                
>             ],
>             "filters":{
>                "items":[
>                   {
>                      "id":"09868595",
>                      "key":{
>                         "dataType":"",
>                         "isColumn":false,
>                         "key":"__temporality__",
>                         "type":""
>                      },
>                      "op":"=",
>                      "value":"Cumulative"
>                   },
>                   {
>                      "id":"03bdd894",
>                      "key":{
>                         "dataType":"string",
>                         "id":"cpu--string--tag--false",
>                         "isColumn":false,
>                         "isJSON":false,
>                         "key":"cpu",
>                         "type":"tag"
>                      },
>                      "op":"=",
>                      "value":"cpu11"
>                   },
>                   {
>                      "id":"8c7eb7e2",
>                      "key":{
>                         "dataType":"string",
>                         "id":"host_name--string--tag--false",
>                         "isColumn":false,
>                         "isJSON":false,
>                         "key":"host_name",
>                         "type":"tag"
>                      },
>                      "op":"=",
>                      "value":"signoz-host"
>                   },
>                   {
>                      "id":"3603c7f6",
>                      "key":{
>                         "dataType":"string",
>                         "id":"os_type--string--tag--false",
>                         "isColumn":false,
>                         "isJSON":false,
>                         "key":"os_type",
>                         "type":"tag"
>                      },
>                      "op":"=",
>                      "value":"linux"
>                   },
>                   {
>                      "id":"738e7ba6",
>                      "key":{
>                         "dataType":"string",
>                         "id":"state--string--tag--false",
>                         "isColumn":false,
>                         "isJSON":false,
>                         "key":"state",
>                         "type":"tag"
>                      },
>                      "op":"=",
>                      "value":"system"
>                   }
>                ],
>                "op":"AND"
>             },
>             "expression":"A",
>             "disabled":false,
>             "stepInterval":60,
>             "having":[
>                
>             ],
>             "limit":null,
>             "orderBy":[
>                
>             ],
>             "groupBy":[
>                
>             ],
>             "legend":"",
>             "reduceTo":"avg"
>          }
>       }
>    }
> }
• Response >
Copy code
{
>     "status": "success",
>     "data": {
>         "resultType": "",
>         "result": [
>             {
>                 "queryName": "A",
>                 "series": [
>                     {
>                         "labels": {},
>                         "labelsArray": null,
>                         "values": [
>                             {
>                                 "timestamp": 1720000800000,
>                                 "value": "0.021500000000135817"
>                             },
>                             {
>                                 "timestamp": 1720000860000,
>                                 "value": "0.023999999999796275"
>                             },
>                             {
>                                 "timestamp": 1720000920000,
>                                 "value": "0.022500000000097012"
>                             },
>                             {
>                                 "timestamp": 1720000980000,
>                                 "value": "0.019999999999951494"
>                             },
>                             {
>                                 "timestamp": 1720001040000,
>                                 "value": "0.023333333333478853"
>                             },
>                             {
>                                 "timestamp": 1720001100000,
>                                 "value": "0.03933333333334303"
>                             },
>                             {
>                                 "timestamp": 1720001160000,
>                                 "value": "0.021166666666492043"
>                             },
>                             {
>                                 "timestamp": 1720001220000,
>                                 "value": "0.021166666666734574"
>                             },
>                             {
>                                 "timestamp": 1720001280000,
>                                 "value": "0.02666666666676368"
>                             },
>                             {
>                                 "timestamp": 1720001340000,
>                                 "value": "0.019833333333129605"
>                             },
>                             {
>                                 "timestamp": 1720001400000,
>                                 "value": "0.02016666666677338"
>                             }
>                         ]
>                     }
>                 ]
>             }
>         ]
>     }
> }
s
Hi, You are doing it right in the query builder. What is the issue?
h
I tried to change PromQL to Query Builder, but I inquired because the result value was different.
s
It won't be absolutely the same as the PromQL because the way Prometheus does things is slightly different. But the results should match.
h
I thought so too, but I left an inquiry because the API Response value was different(The graph shape was different).
s
How much difference do you see? Looking at the above response shared I don't see much difference.
h
The graph shape is completely different. The peak position is different, and PromQL graph rises high at the point where the Query Builder graph falls low.
s
Please tell me the absolute/percentage difference. The graphs lie and knowing the actual difference is more important that visual high and low https://www.heap.io/blog/how-to-lie-with-data-visualization
Looking at your own data shared above I don't see a major difference in values. The values are most around 0.02 in both cases. As I mentioned, the Prometheus does things is differently and can produce slightly different results but they should mostly be the same overall.
h
https://www.desmos.com/calculator/lq8deqqp89 (The link above is a graph drawn from the site with a response value. For convenience, time is indicated only as 1-12. ) The value may not appear to differ much because it is a metric with a small variation, but the shape of the graph is completely different. And I called the same time zone, and the number of results is different from 12 to 11.
s
You are not getting my point. The shape of the graph lies because if you zoom out you don't see the same as when you zoom in. To reiterate my point, the calculation is different b/w Prometheus and ClickHouse query, as a result, the values also vary a little. What is more important is the overall correctness of the data, the absolute difference b/w the value and, not the graph's shape.