etcdhttp

package
v3.5.13 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 26 Imported by: 14

Documentation

Overview

Package etcdhttp implements HTTP transportation layer for etcdserver.

Index

Constants

View Source
const (
	PathHealth                 = "/health"
	PathProxyHealth            = "/proxy/health"
	HealthStatusSuccess string = "success"
	HealthStatusError   string = "error"
)
View Source
const (
	PathMetrics      = "/metrics"
	PathProxyMetrics = "/proxy/metrics"
)

Variables

This section is empty.

Functions

func HandleBasic

func HandleBasic(lg *zap.Logger, mux *http.ServeMux, server etcdserver.ServerPeer)

HandleBasic adds handlers to a mux for serving JSON etcd client requests that do not access the v2 store.

func HandleHealth added in v3.5.11

func HandleHealth(lg *zap.Logger, mux *http.ServeMux, srv ServerHealth)

HandleHealth registers metrics and health handlers. it checks health by using v3 range request and its corresponding timeout.

func HandleHealthForV2 added in v3.5.11

func HandleHealthForV2(lg *zap.Logger, mux *http.ServeMux, srv etcdserver.ServerV2)

HandleHealthForV2 registers metrics and health handlers for v2.

func HandleMetrics added in v3.5.11

func HandleMetrics(mux *http.ServeMux)

HandleMetrics registers prometheus handler on '/metrics'.

func NewHealthHandler

func NewHealthHandler(lg *zap.Logger, hfunc func(ctx context.Context, excludedAlarms StringSet, Serializable bool) Health) http.HandlerFunc

NewHealthHandler handles '/health' requests.

func NewPeerHandler

func NewPeerHandler(lg *zap.Logger, s etcdserver.ServerPeerV2) http.Handler

NewPeerHandler generates an http.Handler to handle etcd peer requests.

func WriteError

func WriteError(lg *zap.Logger, w http.ResponseWriter, r *http.Request, err error)

WriteError logs and writes the given Error to the ResponseWriter If Error is an etcdErr, it is rendered to the ResponseWriter Otherwise, it is assumed to be a StatusInternalServerError

Types

type CheckRegistry added in v3.5.11

type CheckRegistry struct {
	// contains filtered or unexported fields
}

func (*CheckRegistry) InstallHttpEndpoints added in v3.5.11

func (reg *CheckRegistry) InstallHttpEndpoints(lg *zap.Logger, mux *http.ServeMux)

func (*CheckRegistry) Register added in v3.5.11

func (reg *CheckRegistry) Register(name string, check HealthCheck)

func (*CheckRegistry) RootPath added in v3.5.11

func (reg *CheckRegistry) RootPath() string

type Health

type Health struct {
	Health string `json:"health"`
	Reason string `json:"reason"`
}

Health defines etcd server health status. TODO: remove manual parsing in etcdctl cluster-health

type HealthCheck added in v3.5.11

type HealthCheck func(ctx context.Context) error

type HealthStatus added in v3.5.11

type HealthStatus struct {
	Reason string `json:"reason"`
	Status string `json:"status"`
}

HealthStatus is used in new /readyz or /livez health checks instead of the Health struct.

type ServerHealth added in v3.5.11

type ServerHealth interface {
	Range(context.Context, *pb.RangeRequest) (*pb.RangeResponse, error)
	Config() config.ServerConfig
	AuthStore() auth.AuthStore
	// contains filtered or unexported methods
}

type StringSet added in v3.5.11

type StringSet map[string]struct{}

func (StringSet) List added in v3.5.11

func (s StringSet) List() []string

Jump to

Keyboard shortcuts

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