Open IngMiad opened 2 years ago
Okay I think I got it - There will be used different databases for different tenants in postgres. So relevant data from farm tutorial will be in database ngb\<tenant-name> instead of database ngb. So I have been able to find all relevant data in database names 'ngbopeniot'.
There you can find all temporal data in the two tables temporalentity and temporalentityattrinstance in case of Scorpio.
In order to visualize your data with Grafana you will need to:
SELECT
observedat AS "time",
temporalentity_id AS metric,
value
FROM temporalentityattrinstance
WHERE
$__timeFilter(observedat) AND
temporalentity_id = 'urn:ngsi-ld:Animal:pig014' AND
value = value
ORDER BY 1,2
I attached a successful screenshot for pig014.
Just as a suggestion to also help others: Maybe you can add to documentation / tutorial how I can visualize STH data in Grafana in the future as well - I needed quite a long time to figure that out (I asked the question initially at stack overflow 3 months ago with no answer so far https://stackoverflow.com/questions/72995260/question-on-visualization-of-fiware-sth-data-with-grafana).
I have a question regarding STH / temporal API and visualization with Grafana. When I use STH instead of QL+Subscriptions there is another table structure in Time-Series-Database that is not very self-descriptive.
QL+Subscriptions For QL + subscriptions table structure and queries for time series data are documented very well (see here): We will have to use table 'et', time column 'time_index' and metric column 'entity_type' for example. I tested the scenario successfully and had no issues with that.
STH When I want to visualize data with Grafana using STH it is more complicated as the data from temporal API is spreaded across different tables (I guess due to performance reasons). I also attached a picture of table design for Scorpio, but the issue with complex table design is quite similar when I try to use Orion-LD context broker.
I can successfully query data using temporal API e.g. with Scorpio:
Response:
But due to the table design I can't find the entity 'Animal' or attribute e.g. 'heartrate' anywhere in the postgres table design. I also attached table content as csv from most promising table names (entitiy, temporalentity and temporalentityattrinstance), but it just includes buildings and farms.
Question Could you assist how data can be queried from time-series-database when I use Grafana instead of temporal API? Where are the entities and their temporal data stored in case of STH?