Documentation
¶
Overview ¶
Package dbstats samples engine statistics by running a read only script inside each database container.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResourceID ¶
ResourceID is the telemetry resource id for a database.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector samples every running Postgres database.
func New ¶
func New(src Source, ex dbaccess.Exec, out Writer, cfg func() Config, every func() time.Duration, log *slog.Logger) *Collector
New builds a Collector; cfg and every are read before each tick so saved settings apply live.
func (*Collector) CollectOnce ¶
CollectOnce samples each running Postgres database with a small worker pool and a per tick budget.
type Config ¶
type Config struct {
// Timeout bounds one script, both inside psql (statement_timeout) and on the exec.
Timeout time.Duration
// MaxDatabases caps per-database rows and size series.
MaxDatabases int
// MaxOutputBytes caps the script output read back; 0 derives it from MaxDatabases.
MaxOutputBytes int64
}
Config carries limits the caller reads from settings before every tick.
type Source ¶
Source lists databases that are running now on this node; stopped ones are simply absent.