etcd: Index | Files

package etcdhttp

import ""

Package etcdhttp implements HTTP transportation layer for etcdserver.


Package Files

base.go doc.go metrics.go peer.go


const (
    PathMetrics      = "/metrics"
    PathHealth       = "/health"
    PathProxyMetrics = "/proxy/metrics"
    PathProxyHealth  = "/proxy/health"

func HandleBasic Uses

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 HandleMetricsHealth Uses

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

HandleMetricsHealth registers metrics and health handlers.

func HandlePrometheus Uses

func HandlePrometheus(mux *http.ServeMux)

HandlePrometheus registers prometheus handler on '/metrics'.

func NewHealthHandler Uses

func NewHealthHandler(lg *zap.Logger, hfunc func() Health) http.HandlerFunc

NewHealthHandler handles '/health' requests.

func NewPeerHandler Uses

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

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

func WriteError Uses

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

type Health Uses

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

Package etcdhttp imports 22 packages (graph) and is imported by 108 packages. Updated 2020-07-19. Refresh now. Tools for package owners.