Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #67: Backfilled metric - online users #92

Merged
merged 1 commit into from
Jun 20, 2022

Conversation

marcghaly
Copy link
Contributor

Hi @jaypha, hi @brendanheywood,

This is PR for issue #67.

Regards,

Marc

@marcghaly marcghaly requested a review from jaypha May 26, 2022 18:34
@jaypha
Copy link
Contributor

jaypha commented May 27, 2022

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

@marcghaly marcghaly force-pushed the MOODLE_35_STABLE-67 branch 2 times, most recently from 3bd7340 to 5c463dd Compare May 27, 2022 21:09
@jaypha
Copy link
Contributor

jaypha commented May 30, 2022

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 marcghaly force-pushed the MOODLE_35_STABLE-67 branch 6 times, most recently from 6b79f67 to ce4f57e Compare June 1, 2022 15:36
@marcghaly
Copy link
Contributor Author

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
Copy link
Collaborator

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 marcghaly force-pushed the MOODLE_35_STABLE-67 branch 6 times, most recently from bdce8c2 to 458297e Compare June 4, 2022 00:14
// Trick to avoid erasing data when it only needs to be completed.
$this->record_metrics($metricitems);
} else {
$this->delete_metrics($metricclass->get_name());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused why we'd ever need to delete data? If we are being asked to backfill data from time period which already has data then that smells like what ever is calling record_saved_metrics isn't sending correct times

Copy link
Contributor Author

@marcghaly marcghaly Jun 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it confusing seeing different frequencies in the chart - what happens at the moment : it retrieves all data for the requested time-frame unless the frequency changed, when frequency changes, it deletes all data and replaces it with the new data with proper interval. Also, if I request data for 4 months, it will fill data for those 4 months then if I request data for 12 months, it will retrieve data from the lowest timestamp present in DB to the passed point time requested (with the period) - it will only retrieve the missing part.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think deleting data has some business value but I think it should be explicit, similar to the setting for how much data you want to keep around. I don't like the idea of someone trying to add in more data and ending up losing data they already had.

I've split that off into a new issue, if you want you can tackle that after this pr lands:
#104

For this one I'd just want it to only ever add more data

Copy link
Contributor Author

@marcghaly marcghaly Jun 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have set it up so it never deletes data now - but also that if frequency changed it is not overlapping data of another interval - It would get extremely confusing. If frequency changes, timestamp needs to be earlier than lowest one in DB so it completes data, it looks like this. Highlighted the one month period - the other one 1 week.

Screenshot from 2022-06-08 15-54-27

I will sure get on this one once this PR lands.

@brendanheywood
Copy link
Collaborator

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
Copy link
Collaborator

Also I am using postgress too

@marcghaly marcghaly force-pushed the MOODLE_35_STABLE-67 branch 3 times, most recently from 5228228 to 174a1a0 Compare June 7, 2022 23:06
@marcghaly
Copy link
Contributor Author

Hi @brendanheywood,

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

Cheers,

Marc

@marcghaly marcghaly force-pushed the MOODLE_35_STABLE-67 branch 3 times, most recently from 45f3871 to abb7ea9 Compare June 7, 2022 23:50
@marcghaly marcghaly requested a review from brendanheywood June 7, 2022 23:54
@marcghaly marcghaly force-pushed the MOODLE_35_STABLE-67 branch from abb7ea9 to 8f46313 Compare June 8, 2022 00:13
@marcghaly marcghaly force-pushed the MOODLE_35_STABLE-67 branch 2 times, most recently from 433f260 to 2d304fe Compare June 8, 2022 20:01
@marcghaly marcghaly requested a review from brendanheywood June 8, 2022 20:04
@marcghaly marcghaly force-pushed the MOODLE_35_STABLE-67 branch 3 times, most recently from 0cc66bf to 1e8cd4f Compare June 10, 2022 21:03
@marcghaly marcghaly force-pushed the MOODLE_35_STABLE-67 branch from 1e8cd4f to 656cad4 Compare June 10, 2022 21:19
@marcghaly
Copy link
Contributor Author

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

Regards,

Marc

@brendanheywood
Copy link
Collaborator

thanks @marcghaly

@brendanheywood brendanheywood merged commit f6755a5 into MOODLE_35_STABLE Jun 20, 2022
@brendanheywood brendanheywood deleted the MOODLE_35_STABLE-67 branch June 20, 2022 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants