fxdebug

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2018 License: MIT Imports: 13 Imported by: 3

Documentation

Overview

Example
status := healthz.NewStatusChecker(healthz.Healthy)

app := fx.New(
	fx.NopLogger,
	fxt.Bootstrap,
	fx.Provide(
		func() *fxdebug.Config {
			return fxdebug.NewConfig(":8080")
		},
		fxdebug.NewHealthCollector,
		fxdebug.NewServer,
	),
	fx.Invoke(func(collector healthz.Collector) {
		collector.RegisterChecker(healthz.ReadinessCheck, status)
	}),
)

if err := app.Err(); err != nil {
	panic(err)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var ErrServerClosed = http.ErrServerClosed

ErrServerClosed is returned by the underlying server when it stops listening after graceful or forceful shutdown is initiated.

Functions

func NewHealthCollector

func NewHealthCollector(handler Handler) healthz.Collector

NewHealthCollector returns a new healthz.Collector.

func NewServer

func NewServer(params ServerParams) (Handler, Err)

NewServer creates a new debug server.

func NewStatusChecker added in v0.6.1

func NewStatusChecker(collector healthz.Collector) *healthz.StatusChecker

NewStatusChecker returns a new healthz.StatusChecker with "Healthy" as the default value. It also registers the checker in the health collector.

Types

type Config

type Config struct {
	Debug   bool
	Network string
	Addr    string
}

Config holds a list of options used during the debug server construction.

func NewConfig

func NewConfig(addr string) *Config

NewConfig returns a new config populated with default values.

type Err added in v0.2.0

type Err <-chan error

Err accepts an error which causes the application to stop.

type Handler

type Handler interface {
	http.Handler

	// Handle registers the handler for the given pattern.
	// If a handler already exists for pattern, Handle panics.
	Handle(pattern string, handler http.Handler)

	// HandleFunc registers the handler function for the given pattern.
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
}

Handler accepts an http.Handler or http.HandlerFunc and registers it for a pattern.

type ServerParams

type ServerParams struct {
	dig.In

	Config    *Config
	Logger    log.Logger `optional:"true"`
	Lifecycle fxt.Lifecycle
}

ServerParams provides a set of dependencies for a debug server constructor.

Directories

Path Synopsis
metrics

Jump to

Keyboard shortcuts

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