Добавить генератор нагрузки, сбор метрик реплик и сценарии экспериментов для отказов, rolling update и трека 1

This commit is contained in:
2026-11-02 17:44:59 +03:00
parent c5cdcb3377
commit b2973405f3
30 changed files with 2067 additions and 18 deletions
+21
View File
@@ -67,3 +67,24 @@ func Run(ctx context.Context, log *slog.Logger, ln net.Listener, h http.Handler,
log.Info("shutdown completed")
return nil
}
// RunDebug serves h, the internal metrics of the process, on ln until ctx is
// cancelled. Nothing outside the stand's network reaches it and no request
// depends on it, so it closes at once instead of draining.
func RunDebug(ctx context.Context, log *slog.Logger, ln net.Listener, h http.Handler) error {
srv := &http.Server{
Handler: h,
ReadHeaderTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
ErrorLog: slog.NewLogLogger(log.Handler(), slog.LevelWarn),
}
go func() {
<-ctx.Done()
_ = srv.Close()
}()
log.Info("debug listening", "addr", ln.Addr().String())
if err := srv.Serve(ln); !errors.Is(err, http.ErrServerClosed) {
return err
}
return nil
}