GridProtectionAlliance / osisoftpi-grafana

Grafana Data Source Plugin for the OSIsoft PI System
https://grafana.com/plugins/gridprotectionalliance-osisoftpi-datasource
Apache License 2.0
58 stars 30 forks source link

Tested 5.1.0 #166

Open SC-66 opened 2 weeks ago

SC-66 commented 2 weeks ago

I tested the downloadable 5.1.0 version but I don't get Summary to work. It does not work (?). The first picture is using 4.2.0 and the second picture is the 5.1.0 version. The third picture is the dataset.

4.2.0 image

5.1.0 image

Dataset image

SC-66 commented 1 week ago

Another example; The source data are 6 values, ranging from 0.15 to 0.33. Sum of those 6 values is 1.264 tonne. The PI query summary says it is 0,0662 tonne and number of values are 21600.

image

pvmagacho-nde commented 1 week ago

@SC-66 please check the enable interval option. Also use the query inspector option to find out the exact PiWebAPI rest api call.

SC-66 commented 1 week ago

@SC-66 please check the enable interval option. Also use the query inspector option to find out the exact PiWebAPI rest api call.

I don't understand how to use the "Enable Interval" feature. Is there a description of what it does? Why should I use in the query? I just want the total value of the selected attribute (eventweighted) for the time period I selected in the time picker. In the post below I will share the differences in the query between 4.2 and 5.1 but it is above my competence to explain why they differ and whats wrong. Why isnt 5.1 backward compatible with 4.2?

SC-66 commented 1 week ago

This is the working 4.2 version with the query: image

{ "request": { "url": "api/datasources/proxy/uid/efd49e42-28f8-40a2-aed3-11b36b42e3bd/batch", "data": { "Req1": { "Method": "GET", "Resource": "https:///piwebapi/attributes?selectedFields=Type%3BDefaultUnitsName%3BDescription%3BWebId%3BName%3BPath&path=\\\\Applications\Production data\Position\Production Tonnage\G56_BT1100_Tonnage|Tonnage_Hour" }, "Req1001": { "Method": "GET", "ParentIds": [ "Req1" ], "Parameters": [ "$.Req1.Content.WebId" ], "Resource": "https:///piwebapi/streamsets/summary?startTime=2024-10-15T04:00:00.000Z&endTime=2024-10-15T09:59:59.000Z&intervals=6000&summaryType=Total&calculationBasis=EventWeighted&webId={0}" } }, "method": "POST", "hideFromInspector": false }, "response": { "Req1": { "Status": 200, "Headers": { "Content-Type": "application/json; charset=utf-8" }, "Content": { "WebId": "F1AbEpYXRubVugE663qaXJWcCgQnfZLYul66RGUhQBQVqtdIAufi-20PH3FYk6fowoY4xlgUElBRlBST0QuQk9MSURFTi5DT01cQk9MSURFTi5QUk9EXEFQUExJQ0FUSU9OU1xQUk9EVUNUSU9OIERBVEFcQUlUSUtcUFJPRFVDVElPTiBUT05OQUdFXEc1Nl9CVDExMDBfVE9OTkFHRXxUT05OQUdFX0hPVVI", "Name": "Tonnage_Hour", "Description": "Total tonnage produced/transported/weight during last hour. Total value for all child objects.", "Path": "\\\\Applications\Production data\Position\Production Tonnage\G56_BT1100_Tonnage|Tonnage_Hour", "Type": "Double", "DefaultUnitsName": "tonne" } }, "Req1001": { "Status": 200, "Headers": { "Content-Type": "application/json; charset=utf-8" }, "Content": { "Links": {}, "Items": [ { "WebId": "F1AbEpYXRubVugE663qaXJWcCgQnfZLYul66RGUhQBQVqtdIAufi-20PH3FYk6fowoY4xlgUElBRlBST0QuQk9MSURFTi5DT01cQk9MSURFTi5QUk9EXEFQUExJQ0FUSU9OU1xQUk9EVUNUSU9OIERBVEFcQUlUSUtcUFJPRFVDVElPTiBUT05OQUdFXEc1Nl9CVDExMDBfVE9OTkFHRXxUT05OQUdFX0hPVVI", "Name": "Tonnage_Hour", "Path": "\\\\Applications\Production data\Position\Production Tonnage\G56_BT1100_Tonnage|Tonnage_Hour", "Links": { "Source": "https:///piwebapi/attributes/F1AbEpYXRubVugE663qaXJWcCgQnfZLYul66RGUhQBQVqtdIAufi-20PH3FYk6fowoY4xlgUElBRlBST0QuQk9MSURFTi5DT01cQk9MSURFTi5QUk9EXEFQUExJQ0FUSU9OU1xQUk9EVUNUSU9OIERBVEFcQUlUSUtcUFJPRFVDVElPTiBUT05OQUdFXEc1Nl9CVDExMDBfVE9OTkFHRXxUT05OQUdFX0hPVVI" }, "Items": [ { "Type": "Total", "Value": { "Timestamp": "2024-10-15T04:00:00Z", "Value": 1.5811140090227127, "UnitsAbbreviation": "t", "Good": true, "Questionable": false, "Substituted": false, "Annotated": false } } ] } ] } } } }

SC-66 commented 1 week ago

And this is the non-working 5.1.0 version with the query: image

{ "request": { "url": "api/ds/query?ds_type=gridprotectionalliance-osisoftpi-datasource&requestId=Q111", "method": "POST", "data": { "queries": [ { "enableStreaming": { "enable": false }, "target": "\\Applications\Production data\Position\Production Tonnage\G56_BT1100_Tonnage;Tonnage_Hour", "elementPath": "\\Applications\Production data\Position\Production Tonnage\G56_BT1100_Tonnage", "attributes": [ { "label": "Tonnage_Hour", "value": { "value": "Tonnage_Hour", "expandable": false } } ], "segments": [ { "label": "", "value": { "expandable": true, "value": "" } }, { "label": "", "value": { "expandable": true, "value": "" } }, { "label": "Applications", "value": { "expandable": true, "value": "Applications" } }, { "label": "Production data", "value": { "expandable": true, "value": "Production data", "webId": "F1EmpYXRubVugE663qaXJWcCgQuiBWJel66RGUhQBQVqtdIAUElBRlBST0QuQk9MSURFTi5DT01cQk9MSURFTi5QUk9EXEFQUExJQ0FUSU9OU1xQUk9EVUNUSU9OIERBVEE" } }, { "label": "Position", "value": { "expandable": true, "value": "Position", "webId": "F1EmpYXRubVugE663qaXJWcCgQl_ZLYul66RGUhQBQVqtdIAUElBRlBST0QuQk9MSURFTi5DT01cQk9MSURFTi5QUk9EXEFQUExJQ0FUSU9OU1xQUk9EVUNUSU9OIERBVEFcQUlUSUs" } }, { "label": "Production Tonnage", "value": { "expandable": true, "value": "Production Tonnage", "webId": "F1EmpYXRubVugE663qaXJWcCgQmvZLYul66RGUhQBQVqtdIAUElBRlBST0QuQk9MSURFTi5DT01cQk9MSURFTi5QUk9EXEFQUExJQ0FUSU9OU1xQUk9EVUNUSU9OIERBVEFcQUlUSUtcUFJPRFVDVElPTiBUT05OQUdF" } }, { "label": "G56_BT1100_Tonnage", "value": { "expandable": true, "value": "G56_BT1100_Tonnage", "webId": "F1EmpYXRubVugE663qaXJWcCgQnfZLYul66RGUhQBQVqtdIAUElBRlBST0QuQk9MSURFTi5DT01cQk9MSURFTi5QUk9EXEFQUExJQ0FUSU9OU1xQUk9EVUNUSU9OIERBVEFcQUlUSUtcUFJPRFVDVElPTiBUT05OQUdFXEc1Nl9CVDExMDBfVE9OTkFHRQ" } }, { "label": "Select Element", "value": { "value": "-Select Element-" } } ], "isAnnotation": false, "refId": "TotalTonnage", "interpolate": { "enable": false, "interval": "" }, "useLastValue": { "enable": false }, "useUnit": { "enable": false }, "recordedValues": { "boundaryType": "Inside", "enable": true }, "digitalStates": { "enable": false }, "webid": "", "regex": { "enable": false }, "expression": "", "summary": { "basis": "EventWeighted", "duration": "", "enable": true, "interval": "", "nodata": "Null", "sampleInterval": "", "sampleTypeInterval": false, "types": [ { "label": "Total", "value": { "expandable": true, "value": "Total" } } ] }, "nodata": "Null", "startTime": "2024-10-15T04:59:00.000Z", "endTime": "2024-10-15T09:59:59.000Z", "isPiPoint": false, "hideError": false, "scopedVars": { "interval": { "text": "2s", "value": "2s" }, "interval_ms": { "text": "2000", "value": 2000 } }, "datasource": { "type": "gridprotectionalliance-osisoftpi-datasource", "uid": "bde3a28a-8c8a-4ffb-86c3-28a8170b7e5a" }, "datasourceId": 1, "intervalMs": 2000, "maxDataPoints": 6000 } ], "from": "1728968340000", "to": "1728986399000" }, "hideFromInspector": false }, "response": { "results": { "TotalTonnage": { "status": 200, "frames": [ { "schema": { "refId": "TotalTonnage", "meta": { "typeVersion": [ 0, 0 ], "executedQueryString": "https:///PIWebapi/streamsets/summary?startTime=2024-10-15T04:59:00Z&endTime=2024-10-15T09:59:59Z&summaryType=Total&summaryBasis=EventWeighted&webId=F1AbEpYXRubVugE663qaXJWcCgQnfZLYul66RGUhQBQVqtdIAufi-20PH3FYk6fowoY4xlgUElBRlBST0QuQk9MSURFTi5DT01cQk9MSURFTi5QUk9EXEFQUExJQ0FUSU9OU1xQUk9EVUNUSU9OIERBVEFcQUlUSUtcUFJPRFVDVElPTiBUT05OQUdFXEc1Nl9CVDExMDBfVE9OTkFHRXxUT05OQUdFX0hPVVI" }, "fields": [ { "name": "Time", "type": "time", "typeInfo": { "frame": "time.Time" } }, { "name": "G56_BT1100_Tonnage|Tonnage_Hour[Total]", "type": "number", "typeInfo": { "frame": "float64", "nullable": true } } ] }, "data": { "values": [ [ 1728968340000 ], [ 0.05250658573168182 ] ] } } ], "refId": "TotalTonnage" } } } }