Documentation
¶
Overview ¶
Package metrics implements the optional kubesolo Prometheus metrics endpoint.
It exposes a small /metrics HTTP server that surfaces KubeSolo-native gauges describing the health of each control plane component (apiserver, kine, controller-manager, kubelet, kube-proxy, runtime, coredns, webhook), plus build info, kine DB size, and process uptime.
Component-internal Prometheus metrics are out of scope — this endpoint is intentionally small and focused on operator-facing health monitoring.
Index ¶
Constants ¶
const ( ComponentRuntime = "runtime" ComponentKine = "kine" ComponentAPIServer = "apiserver" ComponentController = "controller" ComponentKubelet = "kubelet" ComponentKubeProxy = "kubeproxy" ComponentCoreDNS = "coredns" ComponentWebhook = "webhook" )
componentNames is the canonical list of components that the metrics service reports an "up" gauge for. Channels in componentReady use the same keys.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildInfo ¶
BuildInfo carries version metadata stamped by the Makefile via -ldflags. It is used to populate the kubesolo_build_info gauge.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the kubesolo metrics endpoint service. It follows the same NewService/Run + readyCh pattern as the other kubesolo components.
func NewService ¶
func NewService( ctx context.Context, cancel context.CancelFunc, readyCh chan struct{}, embedded types.Embedded, build BuildInfo, componentReady map[string]<-chan struct{}, ) *Service
NewService creates a new metrics service.
componentReady is a map of component name to readiness channel. The metrics service watches each channel and flips kubesolo_component_up to 1 plus stamps kubesolo_component_ready_timestamp_seconds when the channel closes.
The service does not block any other component on its own readiness — the readyCh argument is only used so main can join the goroutine on shutdown.