rpcutil

package
v3.114.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 27 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GrpcChannelOptions

func GrpcChannelOptions() grpc.DialOption

GrpcChannelOptions returns the defaultCallOptions with the max_receive_message_length increased to 400mb We want to increase the default message size as per pulumi/pulumi#2319

func Healthcheck added in v3.34.0

func Healthcheck(context context.Context, addr string, duration time.Duration, cancel context.CancelFunc) error

Healthcheck will poll the address at duration intervals and then call cancel once it reports unhealthy

func IsBenignCloseErr

func IsBenignCloseErr(err error) bool

IsBenignCloseErr returns true if the error is "expected" upon shutdown of the server.

func MakeInstallDependenciesStreams added in v3.47.0

func MakeInstallDependenciesStreams(
	server pulumirpc.LanguageRuntime_InstallDependenciesServer,
	isTerminal bool,
) (io.Closer, io.Writer, io.Writer, error)

Returns a pair of streams for use with the language runtimes InstallDependencies method

func MakeRunPluginStreams added in v3.47.0

func MakeRunPluginStreams(
	server pulumirpc.LanguageRuntime_RunPluginServer,
	isTerminal bool,
) (io.Closer, io.Writer, io.Writer, error)

Returns a pair of streams for use with the language runtimes RunPlugin method

func OpenTracingClientInterceptor

func OpenTracingClientInterceptor(options ...otgrpc.Option) grpc.UnaryClientInterceptor

OpenTracingClientInterceptor provides a default gRPC client interceptor for emitting tracing to the global OpenTracing tracer.

func OpenTracingInterceptorDialOptions added in v3.46.1

func OpenTracingInterceptorDialOptions(opts ...otgrpc.Option) []grpc.DialOption

Configures gRPC clients with OpenTracing interceptors.

func OpenTracingServerInterceptor

func OpenTracingServerInterceptor(parentSpan opentracing.Span, options ...otgrpc.Option) grpc.UnaryServerInterceptor

OpenTracingServerInterceptor provides a default gRPC server interceptor for emitting tracing to the global OpenTracing tracer.

func OpenTracingServerInterceptorOptions added in v3.46.1

func OpenTracingServerInterceptorOptions(parentSpan opentracing.Span, options ...otgrpc.Option) []grpc.ServerOption

Configures interceptors to propagate OpenTracing metadata through headers. If parentSpan is non-nil, it becomes the default parent for orphan spans.

func OpenTracingStreamClientInterceptor added in v3.39.4

func OpenTracingStreamClientInterceptor(options ...otgrpc.Option) grpc.StreamClientInterceptor

OpenTracingStreamClientInterceptor is OpenTracingClientInterceptor for streaming gRPC calls.

func OpenTracingStreamServerInterceptor added in v3.39.4

func OpenTracingStreamServerInterceptor(parentSpan opentracing.Span,
	options ...otgrpc.Option,
) grpc.StreamServerInterceptor

OpenTracingStreamServerInterceptor is OpenTracingServerInterceptor for instrumenting streaming gRPC calls.

func Serve

func Serve(port int, cancel chan bool, registers []func(*grpc.Server) error,
	parentSpan opentracing.Span, options ...otgrpc.Option,
) (int, chan error, error)

Deprecated. Please use ServeWithOptions and OpenTracingServerInterceptorOptions.

Types

type ServeHandle added in v3.46.1

type ServeHandle struct {
	// Port the server is listening on.
	Port int

	// The channel is non-nil and is closed when the server stops serving. The server will pass a non-nil error on
	// this channel if something went wrong in the background and it did not terminate gracefully.
	Done <-chan error
}

func ServeWithOptions added in v3.46.1

func ServeWithOptions(opts ServeOptions) (ServeHandle, error)

ServeWithOptions creates a new gRPC server, calls opts.Init and listens on a TCP port.

type ServeOptions added in v3.46.1

type ServeOptions struct {
	// Port to listen on. Passing 0 makes the system choose a port automatically.
	Port int

	// Initializer for the server. A typical Init registers handlers.
	Init func(*grpc.Server) error

	// If non-nil, Serve will gracefully terminate the server when Cancel is closed or receives true.
	Cancel chan bool

	// Options for serving gRPC.
	Options []grpc.ServerOption
}

Directories

Path Synopsis
Package rpcerror provides helper types and functions for dealing with errors that cross gRPC boundaries.
Package rpcerror provides helper types and functions for dealing with errors that cross gRPC boundaries.

Jump to

Keyboard shortcuts

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