feat(mail): send service identity mail through a leased worker

This commit is contained in:
shira committed 2026-10-06 21:08:11 +03:00
1 parent 204c6bae62
commit d21fd49a42
58 files changed
+7577 -164

No files matched your search

+18 -5
View File
@@ -92,9 +92,14 @@ groups:
summary: Mail deliveries have an unknown outcome.
description: An attempt may have reached the provider without a conclusive answer; a retry needs the same idempotency key, and after the idempotency window an operator decides.
# Inert until the sending worker exists: TASK-016 must export
# lincodex_mail_sender_running (1 while its loop runs) as part of its
# definition of done. Without that series the rule matches nothing.
# Needs the sending worker (TASK-016), which exports
# lincodex_mail_sender_running: 1 while its loop runs, 0 otherwise, and
# 0 for the whole process lifetime with EMAIL_PROVIDER=disabled, where no
# loop starts. The rule fires only while at least one backend instance
# reports 1, so a stand without a transport stays silent. The age gauge
# counts only service mail (verification and password reset), the kinds
# the worker sends: a due notification waits for TASK-462 and is not
# counted, so a notification backlog never fires this alert.
- alert: LincodexMailDeliveriesOverdue
expr: |
max(lincodex_mail_delivery_oldest_due_pending_age_seconds{job="backend"}) > 900
@@ -104,8 +109,16 @@ groups:
labels:
severity: warning
annotations:
summary: A pending mail delivery has been due for more than 15 minutes.
description: The sending worker runs but does not pick up due deliveries; check its logs and the quota gauges.
summary: A pending service mail delivery has been due for more than 15 minutes.
description: The sending worker runs but does not pick up due service mail (verification or password reset); check its logs and the quota gauges. Notifications are not counted.
- alert: LincodexMailCancelledBroken
expr: sum(increase(lincodex_mail_sender_cancelled_total{job="backend",reason=~"content_invalid|processing_failed"}[15m])) > 0
labels:
severity: warning
annotations:
summary: The mail sending worker cancelled a delivery because of a broken row or a repeated internal failure.
description: Reason content_invalid (the stored content does not match its hash, or the message is unsendable) or processing_failed (the worker failed on the row several times) is a defect or a manual edit, not a user action. Select id, kind, and cancel_reason from deliveries where status is cancelled and read the worker logs for the delivery_id. Cancellations that follow a user action (token_revoked, token_consumed, token_expired, account_not_current) are normal and do not fire this alert.
- alert: LincodexMailMetricsStale
expr: time() - max(lincodex_mail_metrics_last_success_timestamp_seconds{job="backend"}) > 300