Skip to content

Built-in Custom Evaluators

Seven 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, a rule that combines several fields or units at once, or (for a text result with no default scalar comparison path at all) a categorical judgment. 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. Five of the seven implement a condition the upstream pgEdge/pg-healthcheck project also evaluates, just expressed as a function instead of external comparison logic; two have no upstream equivalent at all — see Third-Party Notices.

An eighth evaluator ships alongside these but isn't one of the seven below, since it isn't registered against any specific built-in check: pghf.evaluate_passthrough_severity() is generic — the evaluator for on-event checks, any number of which may point their threshold at this exact same function.

pghf.evaluate_c09_012_subscription_health(p_run_id uuid)

Evaluator for the logical replication subscription health check (a two-part breakdown: apply-worker status, plus PG15+ apply/sync error counts). Two independent conditions at two different severities: critical if any subscription has no active apply worker at all; warning if a subscription's apply or sync error count is nonzero on PG15+ (the error-count data simply isn't present before PG15, which isn't treated as a failure to evaluate). not_evaluable if there are no logical subscriptions on this node.

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

Returns: pghf.evaluation_result.

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_c07_010_toast_compression(p_run_id uuid)

Evaluator for default_toast_compression, a text result with no default scalar comparison path (thresholds only work for integer/numeric/boolean). info if the value is pglz — the slower factory default, since lz4 compresses faster for large TOASTed values at negligible CPU cost; ok otherwise. not_evaluable if no value was collected.

Parameter Type Mandatory Default Description
p_run_id uuid Yes Run to evaluate the TOAST-compression 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.