Documentation
¶
Index ¶
- Constants
- func GracefulStopWithTimeout(srv *grpc.Server, d time.Duration) bool
- func NewGRPCServer(tel *telemetry.Client, opts ...ServerOption) *grpc.Server
- func NewStatsWrapper(statsHandler stats.Handler) stats.Handler
- func ObserveConnection(ctx context.Context, conn *grpc.ClientConn, target string)
- func RegisterChannelzTarget(conn *grpc.ClientConn, clientType string)
- func SetSandboxHeader(header http.Header, hostname string, sandboxID string) error
- func SetUserHeader(header http.Header, user string)
- func StartChannelzSampler(ctx context.Context)
- func StreamToChannel[Res any](ctx context.Context, stream *connect.ServerStreamForClient[Res]) (<-chan *Res, <-chan error)
- type ServerOption
Constants ¶
const IsResumeMetadataKey = "x-sandbox-resume"
IsResumeMetadataKey is the gRPC metadata key used to pass the is_resume/snapshot value from the API client to the orchestrator server. This allows the server-side otelgrpc stats handler to include sandbox.resume in metric attributes during TagRPC, before the request payload is available.
Variables ¶
This section is empty.
Functions ¶
func GracefulStopWithTimeout ¶
GracefulStopWithTimeout invokes srv.GracefulStop and falls back to Stop() if it does not return within d. Returns true if graceful stop completed before the deadline.
grpc.Server.GracefulStop blocks until all pending RPCs finish, with no built-in deadline. A stuck stream would otherwise block process shutdown past Nomad's kill_timeout and result in SIGKILL.
Stop() force-closes transports
func NewGRPCServer ¶
func NewGRPCServer(tel *telemetry.Client, opts ...ServerOption) *grpc.Server
func NewStatsWrapper ¶
NewStatsWrapper wraps grpc stats.Handler and removes healthchecks from tracing.
func ObserveConnection ¶
func ObserveConnection(ctx context.Context, conn *grpc.ClientConn, target string)
func RegisterChannelzTarget ¶
func RegisterChannelzTarget(conn *grpc.ClientConn, clientType string)
func SetSandboxHeader ¶
func SetUserHeader ¶
func StartChannelzSampler ¶
func StreamToChannel ¶
Types ¶
type ServerOption ¶
type ServerOption func(*serverOptions)
ServerOption configures NewGRPCServer.
func WithSandboxResumeMetrics ¶
func WithSandboxResumeMetrics() ServerOption
WithSandboxResumeMetrics adds sandbox.resume attribute to otelgrpc metrics, read from incoming gRPC metadata.