I have data in the below form which tells between [start_time, end_time] I have processed "total_bytes_processed" data and my average processing power in that duration was "average_bytes_processed_per_second" (can be computed from the remaining 3 fields as well).
{
"start_time": "2019-05-01 01:00:00.000Z",
"end_time": "2019-05-04 01:00:00.000Z",
"total_bytes_processed": 102345,
"average_bytes_processed_per_second": 12
}
My requirement is to aggregate "average_bytes_processed_per_second" across overlapping intervals of [start_time, end_time] and show as an area chart.
For eg if the dataset is having 2 records like below:
[{
"start_time": "2019-05-01 00:00:00.000Z",
"end_time": "2019-05-03 00:00:00.000Z",
"total_bytes_processed": 102345,
"average_bytes_processed_per_second": 12
},
{
"start_time": "2019-05-02 00:00:00.000Z",
"end_time": "2019-05-05 01:00:00.000Z",
"total_bytes_processed": 102345,
"average_bytes_processed_per_second": 12
}]
then the output area chart will show data in somewhat below form (where from_time and to_time show the start and end time for a particular value on x-axis):
[{
"from_time": "2019-05-01 00:00:00.000Z",
"to_time": "2019-05-02 00:00:00.000Z",
"average_bytes_processed_per_second": 12
},
{
"from_time": "2019-05-02 00:00:00.000Z",
"to_time": "2019-05-03 00:00:00.000Z",
"average_bytes_processed_per_second": 17
},
{
"from_time": "2019-05-03 00:00:00.000Z",
"to_time": "2019-05-05 00:00:00.000Z",
"average_bytes_processed_per_second": 5
}]
I have tried a few things but I haven't been successful yet, so wanted to know how would others do it?
PS: I don't have access to change source data format/type.