go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/buildbucket/appengine/monitor/README.md (about) 1 # Buildbucket Monitor 2 3 Buildbucket Monitor is a micro-service that periodically computes and reports 4 aggregate views of Build stats. For example: 5 6 - The maximum pending time in a given Builder 7 - Number of Builds per each status in a given Builder 8 9 # How does this work? 10 11 A cron request is triggered periodically. The cron handler computes 12 and reports aggregate views of Build events, using a manual flush(). 13 14 ## Why manual flush()? 15 16 It's to avoid unnecessary resets on the in-memory metric storage. 17 Once metric data is set, tsmon reports the last-seen data repeatedly 18 on every single flush. 19 20 If multiple Appengine instances handles a task of computing aggregated 21 views, the following problem would occur: 22 23 (hh:mm) 24 1. 00:00, Ins-1 computed and reported the views for Builder A 25 2. 00:01, 26 - Ins-1 reported the views for Builder A, computed at the time of 00:00. 27 - Ins-2 computed and reported the views for Builder A. 28 3. 00:02, 29 - Ins-1 reported the views for Builder A, computed at the time of 00:00 30 - Ins-2 reported the views for Builder A, computed at the time of 00:01 31 32 In the above scenario, there is no way to determine which stream tells 33 the most fresh data. To avoid this issue, this module manually flushes 34 the data with proper cleanup beforehand.