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 #140: Performance checks for metrics #144

Closed petersistrom closed 1 year ago

petersistrom commented 2 years ago

Resolves #140

petersistrom commented 2 years ago

To test I ran the following code to insert data into the logs

GLOBAL $DB;
$dataobjects = [];
$res = (1661313653 - 1642996853) / 100;
for ($i = 1590465600; $i < 1661313653; $i += $res) {
    $dataobjects[] = [
        'eventname' => '\core\event\user_created',
        'component' => 'core',
        'action' => 'created',
        'target' => 'user',
        'crud' => 'r',
        'edulevel' => 0,
        'contextid' => 1,
        'contextlevel' => 10,
        'contextinstanceid' => 0,
        'userid' => $i,
        'anonymous' => 0,
        'timecreated' => $i
    ];  
}
$DB->insert_records('logstore_standard_log', $dataobjects);

Then backfilled Online Users for 2 months and the last value is displayed image

jaypha commented 1 year ago

Screenshot from 2022-08-31 10-52-09

I think it should be more descriptive than just saying '1', like "Last recorded '1' at 12:55", or similar.

brendanheywood commented 1 year ago

This is intentional as this is going to get pushed elsewhere for consumption and I want it to be easy to cast to an int or float. So just put that in a code comment