Documentation
¶
Overview ¶
Package coremetricspg reads the Core metrics that PostgreSQL holds: the deployment's root Turn queue and its history, and the database size.
Index ¶
- type Store
- func (s *Store) ReadDatabaseSize(ctx context.Context) (int64, error)
- func (s *Store) ReadExecutionHistory(ctx context.Context, start, end time.Time, resolution time.Duration) (coremetrics.History, error)
- func (s *Store) ReadExecutionSnapshot(ctx context.Context, now time.Time, connectedDeviceIDs []string) (coremetrics.ExecutionSnapshot, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store reads Core metrics from Core's database.
func (*Store) ReadDatabaseSize ¶
ReadDatabaseSize measures the current PostgreSQL database in bytes.
func (*Store) ReadExecutionHistory ¶
func (s *Store) ReadExecutionHistory(ctx context.Context, start, end time.Time, resolution time.Duration) (coremetrics.History, error)
ReadExecutionHistory reads a bounded, repeatable read-only snapshot of root Turn history. The interval is [start,end), with complete epoch-aligned buckets keyed by their UTC start. Interruptions use failed Turns' completed_at and execution_interrupted error code. Queue waits use started_at-created_at in milliseconds, grouped by started_at, including retained history of deleted Sessions. Counts of an empty interval are zero; percentile values without observations are nil. Read errors invalidate the entire result and must not be presented as measured zeros.
func (*Store) ReadExecutionSnapshot ¶
func (s *Store) ReadExecutionSnapshot(ctx context.Context, now time.Time, connectedDeviceIDs []string) (coremetrics.ExecutionSnapshot, error)
ReadExecutionSnapshot counts persisted root Turns across the deployment. WaitingForDaemon is the queued subset whose Session binding is absent from the supplied live registry IDs; callers must distinguish an unavailable registry from an observed empty one before using this method. Age is in seconds, and is nil when the queue is empty. No Session deletion filter hides operational state.