Documentation
¶
Index ¶
- func ApplyTracingToHTTPClient(cli *http.Client)
- func HTTPTracingMiddleware(handler http.Handler, opts ...otelhttp.Option) http.Handler
- func HTTPTracingMiddlewareFunc(handler http.HandlerFunc, opts ...otelhttp.Option) http.Handler
- func NewGRPCServer(opts ...GRPCOption) service.Service
- func NewHTTPServer(opts ...HTTPOption) service.Service
- func NewOpsServer(log logger.Logger, cfg OpsConfig, list ...HealthChecker) service.Service
- type GRPCConfig
- type GRPCOption
- type GRPCService
- type HTTPConfig
- type HTTPOption
- type HealthChecker
- type OpsConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyTracingToHTTPClient ¶
ApplyTracingToHTTPClient propagate tracing.ID and X-Request-ID on exists http.Client.
func HTTPTracingMiddleware ¶
HTTPTracingMiddleware wraps the passed http.Handler, functioning like middleware, in a span named after the operation and with any provided Options.
func HTTPTracingMiddlewareFunc ¶
HTTPTracingMiddlewareFunc wraps the passed http.HandlerFunc, functioning like middleware, in a span named after the operation and with any provided Options.
func NewGRPCServer ¶
func NewGRPCServer(opts ...GRPCOption) service.Service
NewGRPCServer creates new gRPC server and implements service.Service interface.
func NewHTTPServer ¶
func NewHTTPServer(opts ...HTTPOption) service.Service
NewHTTPServer creates http server.
func NewOpsServer ¶
NewOpsServer creates new OPS server and OPS HealthChecker's worker.
Types ¶
type GRPCConfig ¶
type GRPCConfig struct { Enabled bool `env:"ENABLED" default:"false" usage:"allows to enable grpc server"` Reflect bool `env:"REFLECT" default:"false" usage:"allows to enable grpc reflection service"` Address string `env:"ADDRESS" default:":9080" usage:"gRPC server listen address"` Network string `env:"NETWORK" default:"tcp" usage:"gRPC server listen network: tpc/udp"` }
GRPCConfig provides configuration for http server.
type GRPCOption ¶
type GRPCOption func(s *gRPCServer)
GRPCOption allows customizing gRPC server.
func WithGRPCConfig ¶
func WithGRPCConfig(v GRPCConfig) GRPCOption
WithGRPCConfig allows set custom gRPC settings.
func WithGRPCLogger ¶
func WithGRPCLogger(v logger.Logger) GRPCOption
WithGRPCLogger allows set custom gRPC Logger.
func WithGRPCName ¶
func WithGRPCName(v string) GRPCOption
WithGRPCName allows set custom gRPC Name.
func WithGRPCServer ¶
func WithGRPCServer(v *grpc.Server) GRPCOption
WithGRPCServer allows set custom gRPC Server.
func WithGRPCService ¶
func WithGRPCService(v GRPCService) GRPCOption
WithGRPCService allows adding new gRPC Service.
type GRPCService ¶
GRPCService custom interface for gRPC service.
type HTTPConfig ¶
type HTTPConfig struct { Enabled bool `env:"ENABLED" default:"false" usage:"allows to enable http server"` Address string `env:"ADDRESS" default:":8080" usage:"HTTP server listen address"` Network string `env:"NETWORK" default:"tcp" usage:"HTTP server listen network: tpc/udp"` NoTrace bool `env:"NO_TRACE" default:"false" usage:"allows to disable tracing for HTTP server"` }
HTTPConfig provides configuration for http server.
type HTTPOption ¶
type HTTPOption func(*httpServer)
HTTPOption allows customizing http component settings.
func WithHTTPConfig ¶
func WithHTTPConfig(v HTTPConfig) HTTPOption
WithHTTPConfig allows set custom http settings.
func WithHTTPHandler ¶
func WithHTTPHandler(v http.Handler) HTTPOption
WithHTTPHandler allows set custom http.Handler value.
func WithHTTPLogger ¶
func WithHTTPLogger(v logger.Logger) HTTPOption
WithHTTPLogger allows set custom logger value.
func WithHTTPName ¶
func WithHTTPName(v string) HTTPOption
WithHTTPName allows set custom http name value.
type HealthChecker ¶
type HealthChecker interface { Name() string Interval() time.Duration Healthy(ctx context.Context) error }
HealthChecker provides functionality to check health of any entity that implement this interface.
type OpsConfig ¶
type OpsConfig struct { Enabled bool `env:"ENABLED" default:"false" usage:"allows to enable ops server"` Address string `env:"ADDRESS" default:":8081" usage:"allows to set set ops address:port"` Network string `env:"NETWORK" default:"tcp" usage:"allows to set ops listen network: tcp/udp"` NoTrace bool `env:"NO_TRACE" default:"true" usage:"allows to disable tracing"` MetricsPath string `env:"METRICS_PATH" default:"/metrics" usage:"allows to set custom metrics path"` HealthyPath string `env:"HEALTHY_PATH" default:"/healthy" usage:"allows to set custom healthy path"` ProfilePath string `env:"PROFILE_PATH" default:"/debug/pprof" usage:"allows to set custom profiler path"` }
OpsConfig provides configuration for http server.