Skip to content

Built-in Custom Evaluators

Five worked custom-evaluator functions ship with the framework, registered automatically against specific built-in checks whose severity condition can't be expressed as a flat set of thresholds — a rolling baseline, or a rule that combines several fields or units at once. Each takes exactly one parameter, the current run's ID, and returns pghf.evaluation_result, matching the general custom-evaluator contract described in Writing a Custom Evaluator in the Adding Your Own Checks book.

pghf.evaluate_c09_014_replication_lag(p_run_id uuid)

Evaluator for the streaming replay lag check (a per-standby breakdown). Mode-dependent: warning if any standby's replay lag exceeds 30 seconds; critical if a synchronous standby's replay lag specifically exceeds 5 seconds.

Parameter Type Mandatory Default Description
p_run_id uuid Yes Run to evaluate the replay-lag check's raw result for.

Returns: pghf.evaluation_result.

pghf.evaluate_c12_004_apply_lag(p_run_id uuid)

Evaluator for Spock apply lag (a per-peer breakdown). warning if any peer's lag exceeds 300 seconds or 100MB — a condition across two different units that a single numeric tier can't express.

Parameter Type Mandatory Default Description
p_run_id uuid Yes Run to evaluate the apply-lag check's raw result for.

Returns: pghf.evaluation_result.

pghf.evaluate_c12_021_queue_depth(p_run_id uuid)

Evaluator for Spock's replication queue depth. warning if the queue exceeds 10,000 messages or the oldest message exceeds 3,600 seconds — the same across-two-units shape as apply lag above.

Parameter Type Mandatory Default Description
p_run_id uuid Yes Run to evaluate the queue-depth check's raw result for.

Returns: pghf.evaluation_result.

pghf.evaluate_c14_002_wal_rate_baseline(p_run_id uuid)

The worked example referenced from the Adding Your Own Checks book. Evaluator for the write-ahead log generation rate check. Instead of a fixed threshold, it computes a rolling baseline from the trailing 12 prior runs' values, queried directly from the raw-results history with no external state needed, and flags a warning when the current rate exceeds three times that trailing average. Returns not_evaluable with fewer than 3 prior samples to compare against.

Parameter Type Mandatory Default Description
p_run_id uuid Yes Run to evaluate the WAL-rate check's raw result for.

Returns: pghf.evaluation_result.

pghf.evaluate_c14_010_archiver_status(p_run_id uuid)

Evaluator for the WAL archiver status check. critical if the last archiving failure was under an hour ago; warning if the last failure was under a day ago, or the last successful archive is over an hour stale — a compound failure-versus-staleness condition.

Parameter Type Mandatory Default Description
p_run_id uuid Yes Run to evaluate the archiver-status check's raw result for.

Returns: pghf.evaluation_result.

Continue to Reporting.