def get_xid_remaining_ratio()

in postgresql_metrics/metrics_gatherer.py [0:0]


def get_xid_remaining_ratio(_data_dir, db_connection):
    xid_age = get_max_xid_age(db_connection)
    if not xid_age:
        return []
    ratio = round(xid_age / WRAPAROUND_LIMIT, 2)
    percentage_remaining = (1.0 - ratio) * 100
    return [metric_xid_remaining_ratio(percentage_remaining)]