grpc

package
v0.0.0-...-10085a1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
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

func GracefulStopWithTimeout(srv *grpc.Server, d time.Duration) bool

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

func NewStatsWrapper(statsHandler stats.Handler) stats.Handler

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 SetSandboxHeader(header http.Header, hostname string, sandboxID string) error

func SetUserHeader

func SetUserHeader(header http.Header, user string)

func StartChannelzSampler

func StartChannelzSampler(ctx context.Context)

func StreamToChannel

func StreamToChannel[Res any](ctx context.Context, stream *connect.ServerStreamForClient[Res]) (<-chan *Res, <-chan error)

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.

Jump to

Keyboard shortcuts

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