feat(awooop): add source provider freshness heartbeat
Some checks failed
CD Pipeline / tests (push) Failing after 6s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped
Code Review / ai-code-review (push) Failing after 8s

This commit is contained in:
Your Name
2026-05-20 19:31:54 +08:00
parent b1f666826f
commit ced36f2521
7 changed files with 430 additions and 10 deletions

View File

@@ -85,6 +85,7 @@ def build_inbound_source_envelope(
content_sha256 = hashlib.sha256(raw_content.encode()).hexdigest() if raw_content else None
text_refs = _INCIDENT_ID_RE.findall(raw_content or "")
provider_name = str(provider or "unknown").strip().lower() or "unknown"
is_provider_heartbeat = str(stage or "").strip().lower() == "heartbeat"
source_refs = {
"event_ids": _compact_unique([raw_event_id]),
"incident_ids": _compact_unique([incident_id, *text_refs]),
@@ -92,10 +93,14 @@ def build_inbound_source_envelope(
"alert_ids": _compact_unique([provider_event_id, raw_event_id]),
"fingerprints": _compact_unique([fingerprint]),
"sentry_issue_ids": _compact_unique(
[raw_event_id, provider_event_id] if provider_name == "sentry" else []
[raw_event_id, provider_event_id]
if provider_name == "sentry" and not is_provider_heartbeat
else []
),
"signoz_alerts": _compact_unique(
[raw_event_id, alertname] if provider_name == "signoz" else []
[raw_event_id, alertname]
if provider_name == "signoz" and not is_provider_heartbeat
else []
),
}
envelope: dict[str, Any] = {