milestone 26: upstream health answers for the selected period

This commit is contained in:
2026-08-17 18:21:56 +02:00
parent 3ed9a57822
commit e0a7cd8a6b
28 changed files with 2865 additions and 182 deletions
+7 -1
View File
@@ -45,6 +45,12 @@ pub const Config = struct {
/// `State.window`.
pub const window_len = 32;
/// Bytes kept of an `@errorName`, truncated to fit. Shared rather than repeated:
/// `history.Accumulator.Cell` and `upstream_history_repo.WindowStats` carry the
/// same name through the minute aggregates, and three buffers of three different
/// sizes would truncate one error name three ways.
pub const error_name_capacity = 48;
/// The shift is capped so `base_backoff_ms << shift` cannot run away; by then
/// `max_backoff_ms` has clamped the result many doublings ago.
const max_shift = 20;
@@ -55,7 +61,7 @@ pub const State = struct {
total_failures: u64,
last_success_at: ?std.Io.Timestamp,
last_error_at: ?std.Io.Timestamp,
last_error_buf: [48]u8,
last_error_buf: [error_name_capacity]u8,
/// Length of the `@errorName` held in `last_error_buf`, truncated to fit.
last_error_len: u8,
backoff_until: ?std.Io.Timestamp,