homek8s/monitoring/controllers/home/osint-analyst.yaml

87 lines
4.2 KiB
YAML
Raw Normal View History

# osint analyst freshness -> Prometheus (card t_22334588)
#
# On 2026-11-25 the analyst (deploy/osint-news-summarizer) silently stopped
# writing article_summaries and stayed dead for nine days. The scraper kept
# ingesting normally (61.5k rows in articles, newest within minutes), the pod
# stayed Running with restarts 0, and the log carried nothing but INFO batch
# lines and 404s at INFO level -- so every signal the cluster already had said
# "healthy". These two rules are built on the timestamps the exporter in
# apps/base/osint/analyst-exporter.yaml reads straight out of Postgres
# (SeriesMonitor osint-analyst-exporter, ns osint, :9187/metrics):
#
# osint_analyst_last_success_timestamp_seconds max(article_summaries.batch_timestamp)
# osint_ingest_last_article_timestamp_seconds max(articles.timestamp)
# osint_analyst_exporter_up 1 when the last DB read worked
#
# OsintAnalystStale is the general "no brief in over an hour" gate; the
# summarizer loops every 15 min, so an hour of silence cannot be a slow batch.
# OsintIngestAliveButNoBrief is the sharper one: a fresh article row plus a
# summary table frozen for two hours names the exact failure -- ingest fine,
# analyst dark -- without waiting for the read path or the API to be down.
#
# The absent() arm on OsintAnalystStale is deliberate: if the exporter, its
# ServiceMonitor or its scrape disappears, the series vanishes and "no data"
# would otherwise read as "no problem", which is the same invisible-failure
# shape this card exists to kill. Routes through the default Alertmanager
# receiver (Telegram @Siriusdevops_alert_bot).
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: osint-analyst
namespace: monitoring
labels:
release: kube-prometheus-stack
spec:
groups:
- name: osint-analyst
rules:
- alert: OsintAnalystStale
expr: |
(
time() - osint_analyst_last_success_timestamp_seconds > 3600
)
or
absent(osint_analyst_last_success_timestamp_seconds)
for: 30m
labels:
severity: warning
annotations:
summary: >-
osint analyst has written no brief for over an hour
description: >-
The newest article_summaries.batch_timestamp is more than an hour
old (the summarizer loops every 15 minutes), or the freshness
series is missing entirely. The container can still be Running
with restarts 0: a wedged analyst looks exactly like an idle one.
Check `kubectl -n osint logs deploy/osint-news-summarizer --tail=50`
for the interval rc, confirm the exporter target is UP in
Prometheus (job osint-analyst-exporter), and test the analyst
query directly:
`kubectl -n osint exec deploy/osint-db -- psql -U osint -d osint_data -c "select max(batch_timestamp), count(*) from article_summaries"`.
A silently dead model/API key is the usual cause.
- alert: OsintIngestAliveButNoBrief
expr: |
(
time() - osint_analyst_last_success_timestamp_seconds > 7200
)
and
(
time() - osint_ingest_last_article_timestamp_seconds < 7200
)
for: 10m
labels:
severity: warning
annotations:
summary: >-
osint scraper is ingesting but the analyst has written no brief for 2h
description: >-
`articles` has a row younger than two hours while
`article_summaries` has nothing newer than two hours. Ingest fine
+ analyst dark is the shape of the 2026-11-25..12-04 outage, where
the pipeline looked healthy for nine days because only the ingest
side was moving. Confirm the scraper is genuinely alive
(`kubectl -n osint logs deploy/osint-news-scraper --tail=20`) and
then debug the analyst side: summarizer logs, NEWS_SUMMARIZE_*
env, the resolved SUMMARY_MODEL and the Nous API key/inference
endpoint (a dead model or a 404 on every map call writes zero
rows while the loop keeps logging rc=0).