Documentation
¶
Overview ¶
Package ops is the Isopace operational surface: liveness/readiness health checks (Health), a metrics registry with Prometheus text exposition (Metrics, which also implements the runtime.Observer facade), cluster membership (Cluster), and an HTTP admin/management API (API) that ties them together and is guarded by rbac when a policy is supplied.
Everything is stdlib-only (net/http, encoding/json). A distributed cluster membership backend (gossip/raft, or one built on the space NATS adapter) is a drop-in Cluster implementation; StaticCluster is the single-node / static default.
Index ¶
- type API
- type APIOption
- type CheckFunc
- type CheckResult
- type Cluster
- type Gauge
- type Health
- type Introspector
- type Member
- type Metrics
- func (m *Metrics) Counter(name string) runtime.Counter
- func (m *Metrics) Gauge(name string) *Gauge
- func (m *Metrics) Histogram(name string) runtime.Histogram
- func (m *Metrics) StartSpan(ctx context.Context, name string, attrs ...runtime.Attr) (context.Context, runtime.Span)
- func (m *Metrics) WriteText(w io.Writer) error
- type Report
- type StaticCluster
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the HTTP admin/management surface. Build it with NewAPI and mount API.Handler. Liveness and metrics are unauthenticated; /info requires the "admin:read" permission when an rbac policy is configured (open otherwise, for local development).
type APIOption ¶
type APIOption func(*API)
APIOption configures an API.
func WithHealth ¶
WithHealth wires the readiness checks behind /readyz.
func WithIntrospector ¶
func WithIntrospector(i Introspector) APIOption
WithIntrospector adds the component list to /info.
func WithMetrics ¶
WithMetrics wires the metrics registry behind /metrics.
type CheckFunc ¶
CheckFunc is a single readiness probe; returning a non-nil error marks it failed. It is given a context so a probe can honour a deadline.
type CheckResult ¶
CheckResult is the outcome of one named check.
type Cluster ¶
type Cluster interface {
// Self returns this node.
Self() Member
// Members returns all known members, including self.
Members() []Member
}
Cluster reports cluster membership. A distributed implementation (gossip, raft, or one built on the space NATS adapter) is a drop-in; StaticCluster is the single-node / static-list default.
type Gauge ¶
type Gauge struct {
// contains filtered or unexported fields
}
Gauge is a settable instrument.
type Health ¶
type Health struct {
// contains filtered or unexported fields
}
Health is a registry of readiness checks. It is safe for concurrent use.
func (*Health) Check ¶
Check runs every registered check and aggregates the results. With no checks registered the report is healthy.
type Introspector ¶
type Introspector interface {
Components() []string
}
Introspector exposes the running component names for the /info endpoint; *runtime.Host satisfies it.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics is a metrics registry: counters, gauges, and summaries (count+sum, used for histograms and span durations), each broken out by label set. It implements runtime.Observer so instrumentation recorded through that facade is exposed here, and renders the Prometheus text exposition format via Metrics.WriteText. It is safe for concurrent use.
type Report ¶
type Report struct {
Status Status `json:"status"`
Checks map[string]CheckResult `json:"checks"`
}
Report aggregates the results of all checks.
type StaticCluster ¶
type StaticCluster struct {
// contains filtered or unexported fields
}
StaticCluster is a fixed-membership Cluster: this node plus an optional static list of peers. It is the default when no dynamic membership backend is wired in (e.g. a single-node deployment).
func NewStaticCluster ¶
func NewStaticCluster(self Member, peers ...Member) *StaticCluster
NewStaticCluster builds a cluster of self plus peers. self.Self is forced true and peers' Self is forced false.
func (*StaticCluster) Members ¶
func (c *StaticCluster) Members() []Member
Members returns all members, sorted by ID.