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 ¶
func MountServiceCompat ¶ added in v0.2.0
MountServiceCompat registers the upstream-parity unauthenticated GET /{service}/health endpoint. The Astarte Dashboard polls one per service (appengine, realmmanagement, pairing) for its API status indicators; only the status code matters to it, but the body mirrors upstream's envelope.
Deliberate deviation 18 (docs/COMPATIBILITY.md): upstream answers a static 200 here, so the indicator it feeds cannot ever go red. Astrate runs check — the same dependency probe that backs /astrate/v1/readiness — and answers 503 when it fails, which is strictly safer for whoever is reading the Dashboard. A nil check keeps upstream's static 200.
func MountVersionCompat ¶ added in v0.2.0
MountVersionCompat registers GET /{service}/version for one service.
func VersionHandler ¶ added in v0.2.0
func VersionHandler(version string) http.HandlerFunc
VersionHandler answers GET .../version with the upstream envelope {"data":"<version>"} (measured upstream 1.2.0, verify-versions.json).
Types ¶
type Check ¶
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 ¶
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 (*Health) AddReadiness ¶
AddReadiness registers a named dependency probed by /readiness.
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) RegisterBrokerSessions ¶
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).