fledge-iot / fledge

An open source platform for the Industrial Internet of Things, it acts as an edge gateway between sensor devices and cloud storage systems.
https://www.lfedge.org/projects/fledge/
Apache License 2.0
117 stars 43 forks source link

inconsistent number of recorded readings for the asset (GET /fledge/asset or the asset tab in the UI) #1406

Open kwitekrac opened 3 weeks ago

kwitekrac commented 3 weeks ago

Description: I'm experiencing inconsistent number of recorded readings for the asset when running Fledge (Fledge power version) with a custom South Python-based plugin. Fledge is configured with the following storage setup:

Fledge Power version: 2.4.0 and 2.4.0-141(nightly build) Storage plugin: PostgreSQL Readings plugin: SQLMemory South plugin: Python based RabbitMQ client

During testing, I stream approximately 900 datapoints per second to the plugin in one batch, calling:

async_ingest.ingest_callback(c_callback, c_ingest_ref, ingest_elements)

where ingest_elements contains around 900 elements.

Actual Behavior: After running the test, I checked the following metrics:

GET /fledge/south requests (South tab in GUI): The number of updates indicated is 599:

[{"count": 599, "asset": "0292f5b3-7a02-3378-e723-9aef0d8c8831-21-A_mag"}, {"count": 599, "asset": "0292f5b3-7a02-3378-e723-9aef0d8c8831-21-B_mag"} ...]

Note: The message returns the counter per asset, but not for the entire service. The value displayed by the UI is unclear.

GET /fledge/statistics: The same results are shown, with 599 updates received for each asset.

GET /fledge/asset (Asset tab in GUI): Indicates 119 to 120 updates per asset. Observing this parameter during the test, I noticed that around 450 updates, it rolls over to stats from a lower value (possibly starting from zero).

Question: Why is there a inconsistent update count shown in the asset tab?