forge
Clone
https://git.tahinli.com/Tahinli/forge.git
0 watching0 forksRustAGPL-3.07.1 MiB490f099Tahinli7 hours ago322 commits
| 1 | //! The host usage of each CI runner (CPU, memory, network), kept in memory for the graphs on its |
| 2 | //! admin page. A runner ships its samples in batches (`POST /api/v1/ci/runners/metrics`); the forge |
| 3 | //! keeps the last hour per runner, at most `MAX_SAMPLES`. Samples are not stored in the database: |
| 4 | //! a restart of the forge drops them, and the runner keeps sending new ones. |
| 5 | |
| 6 | use ; |
| 7 | use ; |
| 8 | |
| 9 | use ; |
| 10 | |
| 11 | /// How far back samples are kept, in milliseconds, counted from the newest sample. |
| 12 | pub const KEEP_MS: i64 = 3_600_000; |
| 13 | /// Most samples kept per runner. The oldest go first. |
| 14 | const MAX_SAMPLES: usize = 800; |
| 15 | |
| 16 | /// The samples of every runner, by runner id. Shared through `AppState`. |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 |