Do not re-notify old alerts after a restart

The ledger only lives in memory, so a poller that restarts sees every
firing alert as new.

Assume that an alert that started firing more than BOOT_MARGIN ago was
handled by a previous incarnation. An alert becomes firing at activeAt
plus the "for:" duration of its rule, so read those durations from the
rules API instead of hardcoding them.

Apply this assumption to the first cycle only. On a later cycle, an alert
that is not in the ledger is considered to be new.

This commit also handles a scenario where the two prometheus hosts
disagree on the "activeAt" value, by keeping the earliest value.

prometheus_urls now contains the root URL of each prometheus server, and
the code adds the API paths. The values in toolforge-deploy must change
at the same time.

Assisted-by: Claude Opus 5
Assisted-by: Claude Opus 5.5
Bug: T432865


Related MRs:

Edited by FNegri

Merge request reports

Loading