Skip to content
Snippets Groups Projects
Commit cee2be28 authored by Stefano Di Frischia's avatar Stefano Di Frischia
Browse files

L2SS-406: remove views from query

parent 964a5ab3
Branches
Tags
1 merge request!190Resolve L2SS-406 "Grafana archiver"
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
"options": { "options": {
"showHeader": true "showHeader": true
}, },
"pluginVersion": "8.2.4", "pluginVersion": "8.2.5",
"targets": [ "targets": [
{ {
"format": "table", "format": "table",
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
"options": { "options": {
"showHeader": true "showHeader": true
}, },
"pluginVersion": "8.2.4", "pluginVersion": "8.2.5",
"targets": [ "targets": [
{ {
"format": "table", "format": "table",
...@@ -169,110 +169,6 @@ ...@@ -169,110 +169,6 @@
"title": "LTS/RECV/1 archived attributes", "title": "LTS/RECV/1 archived attributes",
"type": "table" "type": "table"
}, },
{
"datasource": "TimescaleDB",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 8
},
"id": 2,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"pluginVersion": "8.2.4",
"targets": [
{
"format": "time_series",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n temp_time AS \"time\",\n temperature[1] as \"temp[1]\",\n temperature[2] as \"temp[2]\",\n temperature[3] as \"temp[3]\",\n temperature[4] as \"temp[4]\",\n temperature[5] as \"temp[5]\",\n temperature[6] as \"temp[6]\",\n temperature[7] as \"temp[7]\",\n temperature[8] as \"temp[8]\",\n temperature[9] as \"temp[9]\",\n temperature[10] as \"temp[10]\",\n temperature[11] as \"temp[11]\",\n temperature[12] as \"temp[12]\",\n temperature[13] as \"temp[13]\",\n temperature[14] as \"temp[14]\",\n temperature[15] as \"temp[15]\",\n temperature[16] as \"temp[16]\"\nFROM sdp_masked_temp_values\nWHERE\n $__timeFilter(temp_time)\nORDER BY temp_time",
"refId": "B",
"select": [
[
{
"params": [
"temperature[1]"
],
"type": "column"
}
]
],
"table": "sdp_masked_temp_values",
"timeColumn": "temp_time",
"timeColumnType": "timestamptz",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"title": "SDP - FPGA Temperature",
"type": "timeseries"
},
{ {
"datasource": "TimescaleDB", "datasource": "TimescaleDB",
"fieldConfig": { "fieldConfig": {
...@@ -304,17 +200,19 @@ ...@@ -304,17 +200,19 @@
"gridPos": { "gridPos": {
"h": 9, "h": 9,
"w": 12, "w": 12,
"x": 12, "x": 0,
"y": 8 "y": 8
}, },
"id": 9, "id": 9,
"interval": "10s",
"maxDataPoints": 1000,
"options": { "options": {
"colWidth": 0.5, "colWidth": 0.3,
"legend": { "legend": {
"displayMode": "list", "displayMode": "list",
"placement": "bottom" "placement": "bottom"
}, },
"rowHeight": 0.9, "rowHeight": 0.78,
"showValue": "auto", "showValue": "auto",
"tooltip": { "tooltip": {
"mode": "single" "mode": "single"
...@@ -328,7 +226,7 @@ ...@@ -328,7 +226,7 @@
"hide": false, "hide": false,
"metricColumn": "none", "metricColumn": "none",
"rawQuery": true, "rawQuery": true,
"rawSql": "SELECT\n temp_time AS \"time\",\n temperature[1] as \"temp[1]\",\n temperature[2] as \"temp[2]\",\n temperature[3] as \"temp[3]\",\n temperature[4] as \"temp[4]\",\n temperature[5] as \"temp[5]\",\n temperature[6] as \"temp[6]\",\n temperature[7] as \"temp[7]\",\n temperature[8] as \"temp[8]\",\n temperature[9] as \"temp[9]\",\n temperature[10] as \"temp[10]\",\n temperature[11] as \"temp[11]\",\n temperature[12] as \"temp[12]\",\n temperature[13] as \"temp[13]\",\n temperature[14] as \"temp[14]\",\n temperature[15] as \"temp[15]\",\n temperature[16] as \"temp[16]\"\nFROM sdp_masked_temp_values\nWHERE\n $__timeFilter(temp_time)\nORDER BY temp_time", "rawSql": "SELECT time_bucket('00:00:01'::interval, q1.\"time\") AS time,\r\n mask(array[q1.value[1]], array[q2.\"value\"[1]]) AS \"temperature[1]\",\r\n mask(array[q1.value[2]], array[q2.\"value\"[2]]) AS \"temperature[2]\",\r\n mask(array[q1.value[3]], array[q2.\"value\"[3]]) AS \"temperature[3]\",\r\n mask(array[q1.value[4]], array[q2.\"value\"[4]]) AS \"temperature[4]\",\r\n mask(array[q1.value[5]], array[q2.\"value\"[5]]) AS \"temperature[5]\",\r\n mask(array[q1.value[6]], array[q2.\"value\"[6]]) AS \"temperature[6]\",\r\n mask(array[q1.value[7]], array[q2.\"value\"[7]]) AS \"temperature[7]\",\r\n mask(array[q1.value[8]], array[q2.\"value\"[8]]) AS \"temperature[8]\",\r\n mask(array[q1.value[9]], array[q2.\"value\"[9]]) AS \"temperature[9]\",\r\n mask(array[q1.value[10]], array[q2.\"value\"[10]]) AS \"temperature[10]\",\r\n mask(array[q1.value[11]], array[q2.\"value\"[11]]) AS \"temperature[11]\",\r\n mask(array[q1.value[12]], array[q2.\"value\"[12]]) AS \"temperature[12]\",\r\n mask(array[q1.value[13]], array[q2.\"value\"[13]]) AS \"temperature[13]\",\r\n mask(array[q1.value[14]], array[q2.\"value\"[14]]) AS \"temperature[14]\",\r\n mask(array[q1.value[15]], array[q2.\"value\"[15]]) AS \"temperature[15]\"\r\n FROM ( SELECT aad.data_time AS \"time\",\r\n aad.value_r AS value\r\n FROM att_array_devdouble aad\r\n JOIN att_conf ac ON aad.att_conf_id = ac.att_conf_id\r\n WHERE aad.value_r IS NOT NULL AND ac.domain = 'stat'::text AND ac.family = 'sdp'::text AND ac.member = '1'::text AND ac.name = 'fpga_temp_r'::text\r\n ORDER BY aad.data_time) q1\r\n JOIN ( SELECT aab.data_time AS \"time\",\r\n aab.value_r AS value\r\n FROM att_array_devboolean aab\r\n JOIN att_conf ac ON aab.att_conf_id = ac.att_conf_id\r\n WHERE aab.value_r IS NOT NULL AND ac.domain = 'stat'::text AND ac.family = 'sdp'::text AND ac.member = '1'::text AND ac.name = 'tr_fpga_mask_r'::text\r\n ORDER BY aab.data_time) q2 ON time_bucket('00:00:01'::interval, q1.\"time\") = time_bucket('00:00:01'::interval, q2.\"time\")\r\n WHERE $__timeFilter(q1.\"time\")\r\n ORDER BY q1.\"time\";",
"refId": "B", "refId": "B",
"select": [ "select": [
[ [
...@@ -364,7 +262,7 @@ ...@@ -364,7 +262,7 @@
"list": [] "list": []
}, },
"time": { "time": {
"from": "now-1h", "from": "now-5m",
"to": "now" "to": "now"
}, },
"timepicker": {}, "timepicker": {},
......
-- LOFAR 2.0 CUSTOMIZED VIEWS
\c hdb
-- SDP FPGA Temperature
create or replace view "sdp_fpga_temp" as
select
ac.att_name as "attribute",
aad.data_time AS "time",
aad.value_r
FROM att_array_devdouble aad join att_conf ac
on aad.att_conf_id = ac.att_conf_id
where aad.value_R is not null
and ac."domain" ='stat' and ac."family" ='sdp' and ac."member" ='1' and ac."name"='fpga_temp_r'
ORDER BY aad.data_time;
-- SDP FPGA Mask
create or replace view "sdp_tr_fpga_mask" as
select
ac.att_name as "attribute",
aab.data_time AS "time",
aab.value_r
FROM att_array_devboolean aab join att_conf ac
on aab.att_conf_id = ac.att_conf_id
where aab.value_R is not null
and ac."domain" ='stat' and ac."family" ='sdp' and ac."member" ='1' and ac."name"='tr_fpga_mask_r'
ORDER BY aab.data_time;
-- SDP Masked values (rounded to 1 second)
create or replace view "sdp_masked_temp_values" as
select time_bucket('1 second',t.time) as "temp_time",
mask(t.value_r,m.value_r) as "temperature"
from sdp_fpga_temp as t
inner join sdp_tr_fpga_mask as m
on time_bucket('1 second',t.time) = time_bucket('1 second',m.time)
order by t."time";
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment