Documentation
¶
Index ¶
- Constants
- func Run(ctx context.Context, targets ...func(ctx context.Context) error) error
- func Shutdown(ctx context.Context, targets ...func(ctx context.Context) error) error
- func ShutdownTimeout(ctx context.Context, timeout time.Duration, ...) error
- type Base
- func (base *Base) BuildInfo() *buildinfo.BuildInfo
- func (base *Base) CheckHealth(_ context.Context) healthcheck.Status
- func (base *Base) HealthChecker() *healthcheck.Checker
- func (base *Base) RouteHandler() serv.RouteHandler
- func (base *Base) Run(ctx context.Context) error
- func (base *Base) Server() *serv.Server
- func (base *Base) Shutdown(ctx context.Context) error
- func (base *Base) Telemetry() *telemetry.Telemetry
- type Logger
- type Option
- func WithBuildInfo(bld *buildinfo.BuildInfo) Option
- func WithHealthChecker(opts ...healthcheck.Option) Option
- func WithIgnoreFaviconRoute() Option
- func WithLogger(log Logger) Option
- func WithName(name string) Option
- func WithNotFoundHandler(h http.Handler) Option
- func WithReadBuildInfo() Option
- func WithRoutesRegisterer(rr serv.RoutesRegisterer) Option
- func WithServerConfig(conf ServerConfig) Option
- func WithServerOption(opts ...serv.Option) Option
- func WithTelemetryConfig(conf telemetry.Config) Option
- type ServerConfig
Constants ¶
View Source
const ( ErrApplyOptions errors.Msg = "error while applying option(s)" ErrSetupServer errors.Msg = "failed to setup server" )
View Source
const ( ErrDuringRun errors.Msg = "an error occurred during run" ErrRunCanceled errors.Msg = "run canceled" ErrDuringShutdown errors.Msg = "an error occurred during shutdown" )
View Source
const ( BuildInfoRoute = buildinfo.MetricName HealthCheckRoute = "healthcheck" FaviconRoute = "favicon" )
Variables ¶
This section is empty.
Functions ¶
func Shutdown ¶
Shutdown calls all targets and blocks until all are called and have returned. Returned errors from these functions are collected and returned at the end.
func ShutdownTimeout ¶
func ShutdownTimeout(ctx context.Context, timeout time.Duration, targets ...func(ctx context.Context) error) error
ShutdownTimeout calls all targets and blocks until all are called and have returned, or when the timeout elapses. Returned errors from these functions are collected and returned at the end.
Types ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
func (*Base) CheckHealth ¶
func (base *Base) CheckHealth(_ context.Context) healthcheck.Status
func (*Base) HealthChecker ¶
func (base *Base) HealthChecker() *healthcheck.Checker
func (*Base) RouteHandler ¶
func (base *Base) RouteHandler() serv.RouteHandler
type Logger ¶
type Logger interface {
logger.BuildInfoLogger
logger.RegisterRouteLogger
logger.OTELLoggerSetter
serv.Logger
accesslog.Logger
healthcheck.Logger
healthclient.Logger
}
type Option ¶
func WithBuildInfo ¶
func WithHealthChecker ¶
func WithHealthChecker(opts ...healthcheck.Option) Option
func WithIgnoreFaviconRoute ¶
func WithIgnoreFaviconRoute() Option
func WithLogger ¶
func WithNotFoundHandler ¶
func WithReadBuildInfo ¶ added in v0.2.0
func WithReadBuildInfo() Option
WithReadBuildInfo reads build info using buildinfo.Read. It also logs the read build when a logger implementing the logger.BuildInfoLogger interface is set using WithLogger.
func WithRoutesRegisterer ¶
func WithRoutesRegisterer(rr serv.RoutesRegisterer) Option
func WithServerConfig ¶
func WithServerConfig(conf ServerConfig) Option
func WithServerOption ¶
func WithTelemetryConfig ¶
Click to show internal directories.
Click to hide internal directories.