observability

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package observability owns Astrate's Prometheus registry and the health/readiness/metrics HTTP surface under /astrate/v1 (docs/DESIGN.md §5.2). The engine and trigger executor self-register their collectors through Registerer(); the broker-session and DB-pool gauges are attached from caller-supplied closures, so this package imports neither the broker nor the store and stays at the top of the dependency order.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check func(ctx context.Context) error

Check reports a dependency's readiness; a nil error means ready. The store DB ping and a broker-listener check are the two §5.2 readiness backends.

type DBPoolStats

type DBPoolStats struct {
	AcquiredConns int32
	IdleConns     int32
	TotalConns    int32
	MaxConns      int32
}

DBPoolStats is the subset of pgxpool.Stat exposed as gauges; the caller maps store.Stat() onto it (keeping pgx out of this package).

type Health

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

Health is the Astrate-native operational surface (docs/DESIGN.md §5.2): liveness, readiness, and the Prometheus scrape endpoint, all under /astrate/v1 so they never collide with the upstream API namespace.

func NewHealth

func NewHealth(metrics http.Handler) *Health

NewHealth builds the surface around an existing metrics handler.

func (*Health) AddReadiness

func (h *Health) AddReadiness(name string, check Check)

AddReadiness registers a named dependency probed by /readiness.

func (*Health) Mount

func (h *Health) Mount(mux *http.ServeMux)

Mount registers the endpoints on mux.

type Metrics

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

Metrics owns the process-wide Prometheus registry.

func NewMetrics

func NewMetrics() *Metrics

NewMetrics builds a registry preloaded with the Go runtime and process collectors (go_*, process_* — the RSS/GC budget of §5.4 reads them).

func (*Metrics) Handler

func (m *Metrics) Handler() http.Handler

Handler serves the registry in the Prometheus text exposition format.

func (*Metrics) RegisterBrokerSessions

func (m *Metrics) RegisterBrokerSessions(fn func() float64)

RegisterBrokerSessions publishes astrate_broker_sessions, read on scrape from fn (broker.SessionCount).

func (*Metrics) RegisterDBPool

func (m *Metrics) RegisterDBPool(fn func() DBPoolStats)

RegisterDBPool publishes the astrate_db_pool_* gauges, read on scrape from fn (a snapshot of store.Stat()).

func (*Metrics) Registerer

func (m *Metrics) Registerer() prometheus.Registerer

Registerer is the engine's Prometheus.Registerer (engine + executor + stream bus collectors attach here).

Jump to

Keyboard shortcuts

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