Skip to content

Refine the doubling logic for web #418#423

Merged
brendanheywood merged 1 commit intoMOODLE_403_STABLEfrom
refine-the-doubling-logic-for-web-#418
Mar 12, 2026
Merged

Refine the doubling logic for web #418#423
brendanheywood merged 1 commit intoMOODLE_403_STABLEfrom
refine-the-doubling-logic-for-web-#418

Conversation

@duyhuynhdev
Copy link

@duyhuynhdev duyhuynhdev commented Jan 30, 2026

#418

Add new doubling logic for web processor only
Update related classes and tests

@duyhuynhdev duyhuynhdev requested a review from bwalkerl January 30, 2026 01:21
@duyhuynhdev duyhuynhdev force-pushed the refine-the-doubling-logic-for-web-#418 branch 2 times, most recently from 89e0b9a to 4769488 Compare January 30, 2026 04:46
Copy link
Contributor

@bwalkerl bwalkerl left a comment

Choose a reason for hiding this comment

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

Thanks @duyhuynhdev

This is a much less destructive change than the previous PR, so we should be able to get this merged in once we iron out everything. The previous PR still does have other benefits, especially for web, but is just unworkable for cron without a clearer way to know when tasks end.

One more thing that is missing here that was in the previous PR is the changes to store event count as well (and fixes for import). I think that would be useful to have here.

Comment on lines +175 to +201

/**
* Parse log entry to sample
*
* @param \ExcimerLogEntry $entry
* @return array
*/
protected function from_log_entry_to_sample($entry) {
return [
"eventcount" => $entry->getEventCount(),
"trace" => $entry->getTrace(),
];
}

/**
* Parse log to samples
*
* @param \ExcimerLog $log
* @return array
*/
protected function from_log_to_samples($log) {
$samples = [];
foreach ($log as $entry) {
$samples[] = $this->from_log_entry_to_sample($entry);
}
return $samples;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

These work, but I can't help but think there might be a simpler way to do this without so many changes.

Copy link
Author

Choose a reason for hiding this comment

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

I also have no idea how to make it simpler ^^. Let me think about after solving all main issues

@duyhuynhdev duyhuynhdev force-pushed the refine-the-doubling-logic-for-web-#418 branch 2 times, most recently from b854424 to bca2036 Compare February 2, 2026 03:59
@duyhuynhdev
Copy link
Author

Hi Ben, I have updated the code. Could you review it again when you back. Thanks

Copy link
Contributor

@bwalkerl bwalkerl left a comment

Choose a reason for hiding this comment

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

This is looking close, the main issue now is just the discrepancy with the duration in the graph, possibly due to a bug in merging or other code needing to be updated.

I've a few new comments alongside the previous ones.

@duyhuynhdev duyhuynhdev force-pushed the refine-the-doubling-logic-for-web-#418 branch from bca2036 to 28cf75d Compare February 24, 2026 02:13
Copy link
Contributor

@bwalkerl bwalkerl left a comment

Choose a reason for hiding this comment

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

Thanks @duyhuynhdev

The sample set abstract class looks great and we've solved the biggest issue, just a few more things to tidy up.

@duyhuynhdev duyhuynhdev force-pushed the refine-the-doubling-logic-for-web-#418 branch 2 times, most recently from 88db363 to 596aff1 Compare February 24, 2026 03:52
Copy link
Contributor

@bwalkerl bwalkerl left a comment

Choose a reason for hiding this comment

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

This looks to be working as intended from my testing.

There can still be edge cases such as two samples with a large number of events next to each other, but this should be much better than blinding dropping half.

Happy for this to be merged, as long as we are OK with the terminology:

  • One thing that can be discussed further is the terminology differences between sample counts and event counts. We have replaced sample counts with event counts, and stored the actual sample counts separately. This does look messy. Would we be better off keeping eventcounts as numsamples and add a new numlogentires column instead?

Copy link
Contributor

@bwalkerl bwalkerl left a comment

Choose a reason for hiding this comment

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

@duyhuynhdev After thinking about it some more I think we have the update the terminology for consistency.

  • Leave numsamples alone, and change the UI back to 'samples' instead of 'events'. This will be the eventcount, as it was before this update. We don't add numevents.
  • Instead of storing the number of log entries as numsamples, store it as numlogentires or numentries
  • There was a fallback method when numevents doesn't exist that can be removed.

This would keep consistency with the terminology in the UI and tables, and should reduce confusion.

@duyhuynhdev duyhuynhdev force-pushed the refine-the-doubling-logic-for-web-#418 branch 2 times, most recently from 8d45cdb to ef53659 Compare February 24, 2026 23:22
@duyhuynhdev duyhuynhdev force-pushed the refine-the-doubling-logic-for-web-#418 branch from ef53659 to 43d9bdf Compare February 24, 2026 23:38
Copy link
Contributor

@bwalkerl bwalkerl left a comment

Choose a reason for hiding this comment

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

Thanks @duyhuynhdev this is looking good to me now, matches the spec, and the confusion has been removed so happy for it to be merged.

The only thing left I can see that might be a concern is the size of the samplepool when we reach high filterrates, but that can be mitigated by settings so I'm not sure how much of a concern it is.

@duyhuynhdev duyhuynhdev force-pushed the refine-the-doubling-logic-for-web-#418 branch from 43d9bdf to c768862 Compare March 12, 2026 02:22
@duyhuynhdev duyhuynhdev force-pushed the refine-the-doubling-logic-for-web-#418 branch from c768862 to d3385c6 Compare March 12, 2026 02:58
@brendanheywood brendanheywood merged commit 418c4da into MOODLE_403_STABLE Mar 12, 2026
28 checks passed
@brendanheywood brendanheywood deleted the refine-the-doubling-logic-for-web-#418 branch March 12, 2026 03:15
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