feat(awooop): show callback gap freshness
This commit is contained in:
@@ -120,7 +120,13 @@ class CallbackReplyAuditSummary(BaseModel):
|
||||
outbound_incident_ref_total: int
|
||||
outbound_reply_markup_total: int = 0
|
||||
outbound_reply_markup_missing_incident_ref_total: int = 0
|
||||
outbound_reply_markup_missing_incident_ref_recent_1h_total: int = 0
|
||||
outbound_reply_markup_missing_incident_ref_recent_24h_total: int = 0
|
||||
outbound_reply_markup_missing_incident_ref_latest_sent_at: datetime | None = None
|
||||
outbound_reply_markup_missing_trace_ref_total: int = 0
|
||||
outbound_reply_markup_missing_trace_ref_recent_1h_total: int = 0
|
||||
outbound_reply_markup_missing_trace_ref_recent_24h_total: int = 0
|
||||
outbound_reply_markup_missing_trace_ref_latest_sent_at: datetime | None = None
|
||||
outbound_reply_markup_missing_incident_ref_top_prefixes: list[
|
||||
OutboundReplyMarkupGapPrefix
|
||||
] = Field(default_factory=list)
|
||||
|
||||
@@ -527,10 +527,47 @@ async def _fetch_callback_reply_audit_summary(
|
||||
'[]'::jsonb
|
||||
) = '[]'::jsonb
|
||||
) AS outbound_reply_markup_missing_incident_ref_total,
|
||||
COUNT(*) FILTER (
|
||||
WHERE source_envelope #>> '{reply_markup,present}' = 'true'
|
||||
AND COALESCE(
|
||||
source_envelope #> '{source_refs,incident_ids}',
|
||||
'[]'::jsonb
|
||||
) = '[]'::jsonb
|
||||
AND COALESCE(sent_at, queued_at) >= NOW() - INTERVAL '1 hour'
|
||||
) AS outbound_reply_markup_missing_incident_ref_recent_1h_total,
|
||||
COUNT(*) FILTER (
|
||||
WHERE source_envelope #>> '{reply_markup,present}' = 'true'
|
||||
AND COALESCE(
|
||||
source_envelope #> '{source_refs,incident_ids}',
|
||||
'[]'::jsonb
|
||||
) = '[]'::jsonb
|
||||
AND COALESCE(sent_at, queued_at) >= NOW() - INTERVAL '24 hours'
|
||||
) AS outbound_reply_markup_missing_incident_ref_recent_24h_total,
|
||||
MAX(COALESCE(sent_at, queued_at)) FILTER (
|
||||
WHERE source_envelope #>> '{reply_markup,present}' = 'true'
|
||||
AND COALESCE(
|
||||
source_envelope #> '{source_refs,incident_ids}',
|
||||
'[]'::jsonb
|
||||
) = '[]'::jsonb
|
||||
) AS outbound_reply_markup_missing_incident_ref_latest_sent_at,
|
||||
COUNT(*) FILTER (
|
||||
WHERE source_envelope #>> '{reply_markup,present}' = 'true'
|
||||
AND NOT has_trace_ref
|
||||
) AS outbound_reply_markup_missing_trace_ref_total,
|
||||
COUNT(*) FILTER (
|
||||
WHERE source_envelope #>> '{reply_markup,present}' = 'true'
|
||||
AND NOT has_trace_ref
|
||||
AND COALESCE(sent_at, queued_at) >= NOW() - INTERVAL '1 hour'
|
||||
) AS outbound_reply_markup_missing_trace_ref_recent_1h_total,
|
||||
COUNT(*) FILTER (
|
||||
WHERE source_envelope #>> '{reply_markup,present}' = 'true'
|
||||
AND NOT has_trace_ref
|
||||
AND COALESCE(sent_at, queued_at) >= NOW() - INTERVAL '24 hours'
|
||||
) AS outbound_reply_markup_missing_trace_ref_recent_24h_total,
|
||||
MAX(COALESCE(sent_at, queued_at)) FILTER (
|
||||
WHERE source_envelope #>> '{reply_markup,present}' = 'true'
|
||||
AND NOT has_trace_ref
|
||||
) AS outbound_reply_markup_missing_trace_ref_latest_sent_at,
|
||||
COALESCE((
|
||||
SELECT jsonb_agg(
|
||||
jsonb_build_object(
|
||||
@@ -739,9 +776,27 @@ def _callback_reply_audit_summary_from_row(
|
||||
"outbound_reply_markup_missing_incident_ref_total": _safe_int(
|
||||
row.get("outbound_reply_markup_missing_incident_ref_total")
|
||||
),
|
||||
"outbound_reply_markup_missing_incident_ref_recent_1h_total": _safe_int(
|
||||
row.get("outbound_reply_markup_missing_incident_ref_recent_1h_total")
|
||||
),
|
||||
"outbound_reply_markup_missing_incident_ref_recent_24h_total": _safe_int(
|
||||
row.get("outbound_reply_markup_missing_incident_ref_recent_24h_total")
|
||||
),
|
||||
"outbound_reply_markup_missing_incident_ref_latest_sent_at": row.get(
|
||||
"outbound_reply_markup_missing_incident_ref_latest_sent_at"
|
||||
),
|
||||
"outbound_reply_markup_missing_trace_ref_total": _safe_int(
|
||||
row.get("outbound_reply_markup_missing_trace_ref_total")
|
||||
),
|
||||
"outbound_reply_markup_missing_trace_ref_recent_1h_total": _safe_int(
|
||||
row.get("outbound_reply_markup_missing_trace_ref_recent_1h_total")
|
||||
),
|
||||
"outbound_reply_markup_missing_trace_ref_recent_24h_total": _safe_int(
|
||||
row.get("outbound_reply_markup_missing_trace_ref_recent_24h_total")
|
||||
),
|
||||
"outbound_reply_markup_missing_trace_ref_latest_sent_at": row.get(
|
||||
"outbound_reply_markup_missing_trace_ref_latest_sent_at"
|
||||
),
|
||||
"outbound_reply_markup_missing_incident_ref_top_prefixes": (
|
||||
top_missing_prefixes
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user