readyz

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package readyz polls a container's HTTP readiness endpoint from inside an ateom. The intent is to detect the moment a container's HTTP server starts accepting connections with single-millisecond latency: while the server is still booting the kernel returns RST in microseconds, so a sub-millisecond poll loop spends almost no time blocked, and once the listen socket is up the next iteration completes the GET on veth-local latency.

Index

Constants

View Source
const (
	// DefaultOverallTimeout applies to probes that do not set
	// timeout_seconds. A workload that needs longer says so on its
	// ActorTemplate rather than having every actor wait as long.
	DefaultOverallTimeout = 30 * time.Second
	RequestTimeout        = 250 * time.Millisecond
	PollInterval          = 1 * time.Millisecond
	DefaultPath           = "/readyz"
)

Tuning knobs. Sized for actor cold-start where the HTTP server may take a few seconds to bind; HTTPClient below is a var so tests can substitute a transport that targets a test server's loopback address.

Variables

View Source
var HTTPClient = func() *http.Client {
	tr := &http.Transport{
		DisableCompression:    true,
		MaxIdleConnsPerHost:   maxIdleConnsHost,
		DialContext:           (&net.Dialer{Timeout: RequestTimeout}).DialContext,
		ResponseHeaderTimeout: RequestTimeout,
	}
	return &http.Client{Transport: tr, Timeout: RequestTimeout}
}

HTTPClient builds a keep-alive HTTP client tuned for fast, repeated probing of a single endpoint. Exposed as a var so tests can substitute a transport that targets a test server's loopback address.

Functions

func URL

func URL(probe *ateompb.Readyz, actorIP string) (string, error)

URL builds the probe endpoint URL. Exported so callers and tests can validate a probe spec before kicking off a Wait.

func Wait

func Wait(ctx context.Context, containerName string, probe *ateompb.Readyz, actorIP string) error

Wait polls the configured HTTP endpoint until it returns 200, the context is cancelled, or the overall deadline is exceeded.

func WaitAll

func WaitAll(ctx context.Context, containers []*ateompb.Container, actorIP string) error

WaitAll blocks until every container with a readyz probe set reports 200, or returns the first error. Containers without a probe are skipped (their absence means "no readiness gate").

Every caller is an ateom RPC handler, so a %w-wrapped Reason dies here: errors.As cannot cross a process, and the interceptor would flatten it to a bare codes.Internal, leaving atelet reading UNKNOWN. The ErrorInfo detail is what carries it. Internal and no crash directive both match today's behavior.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL