grpc

package module
v0.0.0-...-b597003 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer(opts ...grpc.ServerOption) *grpc.Server

NewServer creates a new gRPC server with the given options.

It wraps grpc.NewServer with built-in interceptors, e.g recovery, log buffering, and statsHandler.

func Run

func Run(server *grpc.Server, addresses ...string) func(context.Context) error

Run wraps start/stop of the gRPC server in a single run function with listening on multiple tcp and unix socket address.

It also resister health and reflection services if the services have not registered.

func WithClientTelemetry

func WithClientTelemetry(opts ...otelgrpc.Option)

WithClientTelemetry enables trace and metrics instruments on all gRPC clients.

CAUTION: This function may break in new version of `google.golang.org/grpc` since it is using internal package from grpc.

func WithConfigService

func WithConfigService(configs ...*konf.Config) grpc.ServerOption

WithConfigService registers the pb.ConfigServiceServer implement to the gRPC server.

It uses the global konf.Config if the configs are not provided.

func WithDialOption

func WithDialOption(opts ...grpc.DialOption)

WithDialOption adds global dial options for all gRPC clients.

CAUTION: This function may break in new version of `google.golang.org/grpc` since it is using internal package from grpc.

func WithLogHandler

func WithLogHandler(handler slog.Handler) grpc.ServerOption

WithLogHandler provides the slog.Handler for gRPC logs.

If the handler is not provided, it uses handler from slog.Default().

func WithTelemetry

func WithTelemetry(opts ...otelgrpc.Option) grpc.ServerOption

WithTelemetry enables trace and metrics instruments on the gRPC server.

Types

type ConfigServiceServer

type ConfigServiceServer struct {
	pb.UnimplementedConfigServiceServer
	// contains filtered or unexported fields
}

ConfigServiceServer is an implementation of pb.ConfigServiceServer.

func (ConfigServiceServer) Explain

Directories

Path Synopsis
pb

Jump to

Keyboard shortcuts

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