Добавить генератор нагрузки, сбор метрик реплик и сценарии экспериментов для отказов, rolling update и трека 1
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user