catalyst / moodle-tool_cloudmetrics

Realtime metrics for Moodle
https://moodle.org/plugins/tool_cloudmetrics
GNU General Public License v3.0
0 stars 3 forks source link

Issue #67: Backfilled metric - online users #92

Closed marcghaly closed 2 years ago

marcghaly commented 2 years ago

Hi @jaypha, hi @brendanheywood,

This is PR for issue #67.

Regards,

Marc

jaypha commented 2 years ago

There are some issues here which I have concerns about. I'll be happy to discuss if you want to.

jaypha commented 2 years ago

Hi Marc.

I don't think a meeting is necessary. You have addressed my primary concerns for now. I'm a little iffy about having it controlled from within the database collector, but that's something I'd rather leave to Brendan.

Just that one fix causing the CI problem, and then I am OK to merge. Get Brendan to have a look at the UI aspect.

Regards

marcghaly commented 2 years ago

Hi @brendanheywood,

I have made changes for this PR, a concern that I have is the use of the API for retrieving logs that does not provide a faster / lighter way to retrieve concurrent users (ie: using DISTINCT in a SELECT statement - retrieving all data * with the 2 methods provided by the API get_events_select_iterator, get_events_select seems super heavy to me, please let me know if there is a way I am not aware of) - it seems it is taking a lot of time for this operation, if that were to be left as is, would it need a spinner display ? This is rebased against latest MOODLE_35_STABLE. Concerning a meeting, I am available at 8 PM EST so 10 AM AEST your time, this evening and tomorrow if you want.

Regards,

Marc

brendanheywood commented 2 years ago

hi @marcghaly

If the log api is too slow then do it directly like it was. But just to be be clear @jaypha was doing / has just done a huge refactor of the way the metrics work and I didn't want to waste your time as it would affect your patch. I suspect you will need to have a look at what has landed and rewrite a lot of it (despite there being no conflicts)

We have our standup at 10, so lets chat right after that. Can you please ping me on matrix, I pinged you the other day but you didn't see it and I'm not sure I have the real 'you' in matrix

marcghaly commented 2 years ago

Hi @brendanheywood,

I have made the following changes:

Let me know if this suits.

Regards,

Marc

brendanheywood commented 2 years ago

hi @marcghaly

This is looking great and pretty close, one issue I've found is that when you backfill data you don't end up with nice time periods which align with time period boundaries:

image

If we had a setting that was supposed to have been every hour then I'd expect the backfilled data to be on the hour every hour

A few other small comments in the pr

jaypha commented 2 years ago

Hi Marc

If we had a setting that was supposed to have been every hour then I'd expect the backfilled data to be on the hour every hour

In case you didn't know, there are several functions in the classes/lib.php which can help with this.

marcghaly commented 2 years ago

Hi @brendanheywood,

Just checking, in the following example it is set to be hourly, for example between two first rows, should it display between 12:00 and 16:00 (12, 13, 14, 15 , 16) with a 0 value ? Is that what you mean ? I am using pgsql maybe issue is related to mariadb/mysqli

Screenshot from 2022-06-07 09-39-17

This is what I get with mysql: Screenshot from 2022-06-07 09-57-47

Regards,

Marc

brendanheywood commented 2 years ago

Just checking, in the following example it is set to be hourly, for example between two first rows, should it display between 12:00 and 16:00 (12, 13, 14, 15 , 16) with a 0 value ? Is that what you mean ? I am using pgsql maybe issue is related to mariadb/mysqli

The golden rule is imagine that the metric had been running the whole time and we didn't need to back fill. Ideally the end result should be exactly the same. So yes there would be a metric for every time slice and many of them would be 0

brendanheywood commented 2 years ago

Also I am using postgress too

marcghaly commented 2 years ago

Hi @brendanheywood,

I have made changes according to your comments, If changes are okay I will squash commits.

Cheers,

Marc

marcghaly commented 2 years ago

Hi @brendanheywood, this is squashed and rebased over latest master.

Regards,

Marc

brendanheywood commented 2 years ago

thanks @marcghaly