def METHOD_NAME():
    """
    Retrieves unresolved threshold alerts from the database, mapped to rules
    and metric names.
    """
    alert_map = defaultdict(dict)
    alerts = AlertHistory.objects.filter(
        event_type__id='thresholdState', end_time__gte=INFINITY
    )
    for alert in alerts:
        try:
            ruleid, metric = alert.subid.split(':', 1)
            ruleid = int(ruleid)
        except (AttributeError, ValueError):
            continue
        else:
            alert_map[ruleid][metric] = alert
    return dict(alert_map)