Aeternalis Evolution, a custom-engine persistent evolutionary MMO. This first commit establishes the project skeleton: - Architecture and design docs: project vision, system overview, engineering constitution, roadmap, 19 ADRs, and the simulation, world, network, persistence and infrastructure architectures. - Headless engineering proof: deterministic synthetic particles, component lifecycle, explicit PRNG streams, canonical snapshots and restored execution. - Build and tooling: CMake 3.28+ / Ninja presets, C++23 feature check, clang-format and clang-tidy config, format check script, Windows check script, and a Docker build context. - Tests: unit tests, benchmarks, a snapshot fuzz target and CLI integration wiring. No gameplay, renderer, network service or running deployment yet. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "evo/core/types.hpp"
|
|
|
|
#include <cstdint>
|
|
#include <ostream>
|
|
|
|
namespace evo {
|
|
struct SimulationMetrics {
|
|
Tick tick;
|
|
std::uint64_t active_entities;
|
|
};
|
|
// Host-owned observers; no kernel calls to I/O, exporters or clocks.
|
|
class MetricsSink {
|
|
public:
|
|
virtual ~MetricsSink() = default;
|
|
virtual void observe(SimulationMetrics metrics) = 0;
|
|
};
|
|
class PrometheusTextSink final : public MetricsSink {
|
|
public:
|
|
explicit PrometheusTextSink(std::ostream& output) : output_{output} {}
|
|
void observe(SimulationMetrics metrics) override {
|
|
output_ << "# TYPE evo_simulation_tick gauge\nevo_simulation_tick " << metrics.tick.value
|
|
<< "\n# TYPE evo_active_entities gauge\nevo_active_entities "
|
|
<< metrics.active_entities << '\n';
|
|
}
|
|
|
|
private:
|
|
std::ostream& output_;
|
|
};
|
|
// Typed static names keep these records bounded without arbitrary-string escaping.
|
|
inline void log_error(std::ostream& output, Error error) {
|
|
output << "{\"level\":\"error\",\"event\":\"" << error_name(error) << "\"}\n";
|
|
}
|
|
} // namespace evo
|