health

package
v0.0.0-...-74adf86 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Health check handlers for API service

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Status  Status `json:"status"`
	Message string `json:"message,omitempty"`
}

Check represents an individual health check

type Handler

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

Handler provides health check endpoints

func NewHandler

func NewHandler(cacheManager *cache.Manager, logger *zap.Logger, version string) *Handler

NewHandler creates a new health check handler

func (*Handler) Health

func (h *Handler) Health(w http.ResponseWriter, r *http.Request)

Health handles /health endpoint - basic liveness check Returns 200 if service is running, regardless of dependencies

func (*Handler) Healthz

func (h *Handler) Healthz(w http.ResponseWriter, r *http.Request)

Healthz is a simple health check endpoint for backwards compatibility

func (*Handler) Ready

func (h *Handler) Ready(w http.ResponseWriter, r *http.Request)

Ready handles /ready endpoint - readiness check Returns 200 only if service is ready to accept traffic

type HealthResponse

type HealthResponse struct {
	Status    Status           `json:"status"`
	Version   string           `json:"version,omitempty"`
	Timestamp time.Time        `json:"timestamp"`
	Checks    map[string]Check `json:"checks,omitempty"`
}

HealthResponse represents the health check response

type Status

type Status string

Status represents the health status of the service

const (
	StatusHealthy   Status = "healthy"
	StatusDegraded  Status = "degraded"
	StatusUnhealthy Status = "unhealthy"
)

Jump to

Keyboard shortcuts

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