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

Summaries does not work in 5.0.0 #160

Open SC-66 opened 1 month ago

SC-66 commented 1 month ago

In version 5.0.0 the "Summaries" works completely different compared to 4.2.0. It looks like a bug, if not then all our dashboards must be remade. First, this is the output in 4.2.0 when using Range for an attribute: image

And this is the same when using 5.0.0: image

  1. The element name is now shown before the attribute. This is not the same behavior as in 4.2.0.
  2. Time is now written "time". In 4.2.0 it was "Time". Why change?
  3. The Range summary is not working; It does not present the Range value of that attribute for selected time period (in this example: Today). Instead it shows the range for a set time period of 30 secs, why that time period, and logs it as separate values. The Range, and al other summarize types should use the time period set by the Grafana time picker. This is a completely new behavior which must be a bug. (Note: We are using webapi 2023 SP1)
SC-66 commented 1 month ago

Can this be fixed in 5.1.0?

coderReview commented 1 month ago
  1. This was a change in naming
  2. That was a typo that was fixed
  3. I made some changes in v5.1.0 to use more options in PiWebAPI. If you can provide an example of the PiWebAPI Url to use I can check against what is being used
SC-66 commented 1 month ago

Hello!

  1. Can it be changed back as it was? Or as an option to use? Having the element name before the attribute name for every data point cause makes it very difficult to use general (generic) transformations for all elements.

  2. OK!

  3. I might misunderstand what you mean by "example of the PiWebAPI Url to use" but for example, here is the query that works in 4.2.0 but not in 5.0.0: ( I cannot provide the 5.0.0 query since we cant use that version, we changed back to 4.2.0) In the example below "Range" is used, but we use all summaries types. image

{ "request": { "url": "api/datasources/proxy/uid/", "data": { "Req1": { "Method": "GET", "Resource": "https:///piwebapi/attributes?selectedFields=Type%3BDefaultUnitsName%3BDescription%3BWebId%3BName%3BPath&path=\\\\Applications\Mobile Machines\Grafana\GAR_111BRO|TotalDrilledMeters" }, "Req1001": { "Method": "GET", "ParentIds": [ "Req1" ], "Parameters": [ "$.Req1.Content.WebId" ], "Resource": "https:///piwebapi/streamsets/summary?startTime=2024-09-07T22:00:00.000Z&endTime=2024-09-08T21:59:59.999Z&intervals=6000&summaryType=Range&calculationBasis=EventWeighted&webId={0}" } }, "method": "POST", "hideFromInspector": false }, "response": { "Req1": { "Status": 200, "Headers": { "Content-Type": "application/json; charset=utf-8" }, "Content": { "WebId": "", "Name": "TotalDrilledMeters", "Description": "Total Drilled Meters", "Path": "\\\\Business Units\Garpenberg\Assets\Mine\Mobile Machines\Drilling and charging\Face drilling\GAR_111BRO|TotalDrilledMeters", "Type": "Double", "DefaultUnitsName": "meter" } }, "Req1001": { "Status": 200, "Headers": { "Content-Type": "application/json; charset=utf-8" }, "Content": { "Links": {}, "Items": [ { "WebId": "", "Name": "TotalDrilledMeters", "Path": "\\\\Business Units\Garpenberg\Assets\Mine\Mobile Machines\Drilling and charging\Face drilling\GAR_111BRO|TotalDrilledMeters", "Links": { "Source": "https:///piwebapi/attributes/" }, "Items": [ { "Type": "Range", "Value": { "Timestamp": "2024-09-07T22:00:00Z", "Value": 844.5999999999767, "UnitsAbbreviation": "m", "Good": true, "Questionable": false, "Substituted": false, "Annotated": false } } ] } ] } } } }

pvmagacho-nde commented 1 month ago
  1. You can use the Regex to remove it. Search: (.*)|(.*) and Replace: $2
  2. ok
  3. I will check but the URL should be the same
coderReview commented 3 weeks ago

These are the possible URLs:

1) "streamsets/summary?startTime=2024-09-19T06:13:23Z&endTime=2024-09-19T18:13:23Z&summaryType=Range&summaryBasis=EventWeighted&summaryDuration=1h&sampleType=Interval&sampleInterval=1h&webId= 2) streamsets/summary?startTime=2024-09-19T06:13:51Z&endTime=2024-09-19T18:13:51Z&summaryType=Range&summaryBasis=EventWeighted&summaryDuration=1h&webId= 3) streamsets/summary?startTime=2024-09-19T06:14:05Z&endTime=2024-09-19T18:14:05Z&summaryType=Range&summaryBasis=EventWeighted&webId=

All are working