obs

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: GPL-2.0, GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package obs wires the shared observability libraries to pg-autodump's domain: a metrics registry (github.com/cplieger/metrics/v2) exposed at /metrics, and a startup preflight used to decide the health-marker state. The orchestrator records through the narrow dump.Recorder interface it defines; this package supplies the concrete implementation, so the core stays testable against a fake or nil recorder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Preflight

func Preflight(dumpDir string, specs []spec.DBSpec) error

Preflight reports whether the liveness preconditions hold: the client binaries resolve on PATH, the dump directory is writable, and DB_SPECS lists at least one entry. It deliberately does NOT probe per-host database reachability (that is a per-dump, per-DB concern), so a transiently-down database never flips the container unhealthy. Returns nil when healthy, else a reason for the log.

Types

type Metrics

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

Metrics holds the registry and the pg-autodump metric set. It implements dump.Recorder. All names are registered without the "pg_autodump_" prefix; the registry prepends it (e.g. dump_db_total -> pg_autodump_dump_db_total).

func NewMetrics

func NewMetrics() *Metrics

NewMetrics constructs and registers the metric set under the "pg_autodump" namespace.

func (*Metrics) Handler

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

Handler serves the Prometheus text exposition for /metrics.

func (*Metrics) IncRun

func (m *Metrics) IncRun()

IncRun records that a dump run started. Called once per run by the trigger, not per database.

func (*Metrics) RecordResult

func (m *Metrics) RecordResult(r *dump.Result)

RecordResult records one completed per-database outcome.

func (*Metrics) SetInFlight

func (m *Metrics) SetInFlight(n int)

SetInFlight reports the current number of dumps actively running.

Jump to

Keyboard shortcuts

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