Foundation / checks (deploy) (push) Successful in 3m20s
Foundation / checks (ecs) (push) Successful in 1m59s
Foundation / checks (client) (push) Failing after 10m0s
Foundation / checks (network) (push) Successful in 13m9s
Foundation / checks (tsan) (push) Successful in 8m1s
Foundation / checks (checks) (push) Successful in 32m2s
Foundation / checks (postgres) (push) Failing after 26m39s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
ADR-0097 (M10.9 load and abuse qualification; only evolution-dev reference-worker runs qualify). evo-server measures each simulated tick's work (host step plus the M10 bridge, with the session layer's share kept separately) and feeds a portable LoadGovernor: grant logins are refused at a 2 s p95 of 15 ms or any tick debt, replication is shed in up to three levels at 20 ms or debt >= 2 (radius cap 7/7/5/3, far updates x1/x2/x2/x4, no fresh baselines, own markers unaffected), and both relax after 5 s of calm. Handoff tickets are still admitted. /metrics gains evo_m10_* gauges when the listener is enabled. Adds the missing ADR index entries for ADR-0094 to ADR-0096. Refreshes the dev session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
67 lines
3.1 KiB
C++
67 lines
3.1 KiB
C++
#pragma once
|
|
#include "evo/server/load_governor.hpp"
|
|
#include <array>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
// Region host status and its bounded operational exposition (M7.8, ADR-0066).
|
|
// Portable: no sockets, clocks or persistence types. Liveness is not authority:
|
|
// only `ready` means the host may originate output.
|
|
namespace evo::server {
|
|
enum class HostPhase : std::uint8_t {
|
|
acquiring, // Waiting for the lease (busy/unavailable) or recovering.
|
|
running, // Authoritative: simulating and committing.
|
|
resolving, // A commit outcome is unknown: paused until resolved.
|
|
draining, // Shutdown: committing pending work, then releasing.
|
|
stopped, // Drained (lease released when possible).
|
|
quarantined, // Fail closed: committed state or history cannot be trusted.
|
|
};
|
|
inline constexpr std::size_t host_phase_count = 6;
|
|
// Why an accepted input will never be acknowledged by this host.
|
|
enum class Unacknowledged : std::uint8_t {
|
|
refused, // The simulation rejected it; no tick consumed it.
|
|
drained, // Still queued at shutdown.
|
|
fenced, // Authority was lost before its tick committed; the next owner never saw it.
|
|
quarantined,
|
|
};
|
|
inline constexpr std::size_t unacknowledged_count = 4;
|
|
|
|
struct HostStatus {
|
|
HostPhase phase{HostPhase::acquiring};
|
|
bool ready{}; // Authoritative now: recovered, running, lease may originate.
|
|
std::uint64_t epoch{};
|
|
std::uint64_t simulated_tick{}, committed_tick{}, committed_sequence{};
|
|
std::size_t queued{}, queued_bytes{};
|
|
std::uint64_t tick_debt{}, max_tick_debt{}; // Due minus simulated since running.
|
|
std::uint64_t commits{}, store_failures{}, unknown_outcomes{}, fences{};
|
|
// Local lease safety: time until this host must stop originating (0 = none).
|
|
std::uint64_t lease_remaining_ms{};
|
|
};
|
|
|
|
// Process-level counters and bounds the exposition adds to the host status.
|
|
struct OpsCounters {
|
|
std::size_t queue_capacity_inputs{}, queue_capacity_bytes{};
|
|
std::uint64_t checkpoint_age_ms{}; // Since the last confirmed commit or recovery.
|
|
std::uint64_t acks{}, outcomes{};
|
|
std::array<std::uint64_t, unacknowledged_count> dropped{}; // Indexed by Unacknowledged.
|
|
// M8.5: object volume free space and the store's reserve (ADR-0070), so capacity
|
|
// is alerted on before new objects are refused.
|
|
std::uint64_t objects_available_bytes{}, objects_reserve_bytes{};
|
|
// M10.9a (ADR-0097): the M10 session listener's load governor, rendered only when the
|
|
// listener is enabled.
|
|
bool m10_enabled{};
|
|
std::uint64_t m10_sessions{}, m10_refused_logins{};
|
|
LoadState m10_load;
|
|
};
|
|
|
|
[[nodiscard]] const char* phase_name(HostPhase phase) noexcept;
|
|
[[nodiscard]] const char* unacknowledged_name(Unacknowledged reason) noexcept;
|
|
|
|
// Prometheus text format 0.0.4. Fixed metric names; the only labels are `phase`
|
|
// (6 values) and `reason` (4 values), so cardinality is bounded by construction.
|
|
// No world/region/entity/request labels: scrape targets carry region identity.
|
|
[[nodiscard]] std::string render_metrics(const HostStatus& status, const OpsCounters& counters);
|
|
inline constexpr std::size_t max_metrics_bytes = 8192;
|
|
} // namespace evo::server
|