Why the measurement java sdk returns only parts of the data within a date and within a hour also?

What product/components do you use and which version/fix level are you on?

cumulocity

Is your question related to the free trail, or to a production (customer) instance?

Customer license

What are you trying to achieve? Please describe in detail.

Why the measurement java sdk returns only parts of the data within a date and within a hour also?

I am trying to fetch the mesurements of a day using the measurements API of java sdk through the measurementapi. But everytime i fetch a single day’s records, I get inconsistent data.
For example:
For 13th hour I get measurements of 13.00, 13:05,13:10, 13:15, 13:20, 13:25, 13:30, 13:40, 13:50. Missing are 13:35, 13:45, 13:55.
During the next immediate fetch for the same 13th hour it returns only 13:00, 13:10, 13:20, 13:30, 13:40, 13:50 only (for every alternate 5 mins)

Why is this inconsistency? AM I doing anything wrong?

My code snippet below:

final MeasurementFilter filter1 = new MeasurementFilter().bySource(new GId(deviceId)).byValueFragmentType(valueFragmentType).byDate(dateFrom.toDate(), dateTo.toDate());

final Iterable measureArrColl = measurementApi.getMeasurementsByFilter(filter1).get(5000,RevertQueryParameter.getInstance()).allPages();

LOGGER.info("measureArr1 "+measureArr1);

At the same time, if I use RestTemplate calls to the measurements API of cumulocity I am able to fetch all the records for an hour and for a day or any date range supplied.

Also, please help if there is a way to sort the data fetched using measurmentapi java sdk?

Do you get any error messages? Please provide a full error message screenshot and log file.

No

Have you installed all the latest fixes of the products and systems you are using?

Hi Sethu,

can you provide more details how dateFrom & dateTo is defined? And also how you iterate over the measureArrColl?
Why the pageSize of 5000? The maximum supported pageSize is 2000.
If the page size is not relevant I would keep it to the default value and just passing the revert queryParam:

final Iterable measureArrColl = measurementApi.getMeasurementsByFilter(filter1).get(RevertQueryParameter.getInstance()).allPages();

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.