health

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package health provides an extended health status graph for Runtime.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder assembles a Report.

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates a Builder.

func (*Builder) Build

func (b *Builder) Build(now time.Time) Report

Build computes overall status (worst-wins with lockdown/quarantine priority). Nodes and edges are sorted so identical runtime state produces identical JSON.

func (b *Builder) Link(from, to string)

Link adds a dependency edge.

func (*Builder) Set

func (b *Builder) Set(n Node)

Set adds or replaces a node.

type Edge

type Edge struct {
	From string `json:"from"`
	To   string `json:"to"`
}

Edge relates nodes (dependency). From depends on To.

type Node

type Node struct {
	Name    string            `json:"name"`
	Status  Status            `json:"status"`
	Message string            `json:"message,omitempty"`
	Attrs   map[string]string `json:"attrs,omitempty"`
}

Node is one node in the health graph.

type Report

type Report struct {
	Time    time.Time `json:"time"`
	Overall Status    `json:"overall"`
	Nodes   []Node    `json:"nodes"`
	Edges   []Edge    `json:"edges,omitempty"`
}

Report is a graph-oriented health snapshot.

func (Report) Dependents added in v0.9.0

func (r Report) Dependents(name string) []string

Dependents returns every node transitively affected when name becomes unavailable. Because Edge.From depends on Edge.To, the traversal follows reverse edges.

func (Report) Node added in v0.9.0

func (r Report) Node(name string) (Node, bool)

Node returns a named health node and whether it exists.

func (Report) Validate added in v0.9.0

func (r Report) Validate() []ValidationIssue

Validate checks node identity, dependency endpoints, self-dependencies, and cycles.

type Status

type Status string

Status is an extended health signal.

const (
	Healthy     Status = "healthy"
	Degraded    Status = "degraded"
	Unhealthy   Status = "unhealthy"
	Blocked     Status = "blocked"
	Unknown     Status = "unknown"
	Quarantined Status = "quarantined"
	LockedDown  Status = "locked-down"
)

type ValidationIssue added in v0.9.0

type ValidationIssue struct {
	Code    string `json:"code"`
	Node    string `json:"node,omitempty"`
	Message string `json:"message"`
}

ValidationIssue describes a structural problem in a health report.

Jump to

Keyboard shortcuts

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