grpcx

package
v0.0.0-...-5117fa9 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: MIT Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecoveryWithLogger

func RecoveryWithLogger(options *serverOptions) grpc_recovery.RecoveryHandlerFunc

Types

type Option

type Option func(*serverOptions)

func WithAuthFunc

func WithAuthFunc(authFunc grpc_auth.AuthFunc) Option

func WithGrpcOption

func WithGrpcOption(option grpc.ServerOption) Option

func WithLogger

func WithLogger(logger *zap.Logger) Option

func WithPrometheus

func WithPrometheus(listen string) Option

func WithRegistry

func WithRegistry(register registry.Registry, serviceName string, listen string) Option

func WithStreamServerInterceptor

func WithStreamServerInterceptor(intercoptors ...grpc.StreamServerInterceptor) Option

func WithTracer

func WithTracer(tracer opentracing.Tracer) Option

func WithUnaryServerInterceptor

func WithUnaryServerInterceptor(intercoptors ...grpc.UnaryServerInterceptor) Option

type Server

type Server struct {
	Name   string
	Option *serverOptions
}

func Micro

func Micro(name string, opts ...Option) (*Server, error)

micro service stack support. if you use prometheus, the http server implement yourself example:

  httpServer := &http.Server{
		Handler: promhttp.HandlerFor(reg, promhttp.HandlerOpts{}),
		Addr: fmt.Sprintf("0.0.0.0:%d", 9092)
	 }

	go func() {
		if err := httpServer.ListenAndServe(); err != nil {
			log.Fatal("Unable to start a http server.")
		}
	}()

func NewServer

func NewServer(name string, opts ...Option) *Server

func (Server) BuildGrpcServer

func (t Server) BuildGrpcServer() *grpc.Server

func (Server) Run

func (t Server) Run(rpcSrv *grpc.Server, listen string) error

func (Server) StartPrometheus

func (t Server) StartPrometheus(rpcSrv *grpc.Server)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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