Repository navigation
Description
Context & Rationale
Split off from #548. After #548, Alloy's alloy-logs DaemonSet is the only component that ships pod logs to Loki (k8s/monitoring/k8s-monitoring-values.yaml:70-72, 142-154). If it stops, logs stop arriving and nothing reports it. It could stop because it lost API egress, is crash-looping, or Loki rejects its pushes. #548's gate test only catches configuration causes.
Nothing can alert on this today:
- Prometheus holds no log-pipeline series: no
loki_*from Loki and noloki_write_*from Alloy (checked 2026-10-01).alloy-logsserves metrics on port 12345 (Servicek8s-monitoring-alloy-logs), but nothing scrapes it. Metrics for the rest of the platform #551 adds scrapes for Loki and other components. - No alert rules and no Alertmanager exist (Alerts fire into nothing: no Alertmanager, and k3s false positives #549).
- The
loki-canaryDaemonSet pushes its own lines straight to Loki (-push=true). It measures Loki, not the shipper.
Scope & Deliverables
- Deliverable:
- Two Prometheus alert rules, routed by Alerts fire into nothing: no Alertmanager, and k3s false positives #549's Alertmanager:
PodLogsNotShipped: analloy-logspod sent no entries to Loki for 30 minutes;PodLogsDropped: analloy-logspod dropped entries in the last 15 minutes.
- A scrape of the
alloy-logsmetrics, if Metrics for the rest of the platform #551 did not add one.
- Two Prometheus alert rules, routed by Alerts fire into nothing: no Alertmanager, and k3s false positives #549's Alertmanager:
- Acceptance criteria:
- The rules sit next to Alerts fire into nothing: no Alertmanager, and k3s false positives #549's rules. A gate test asserts their names, expressions and
fordurations as one structural tuple. Verified byuv run pyteston that test: under 1 s, with no cluster or network. - A person checks on homelab-k3s, with
kubectl --context homelab-k3s port-forward -n monitoring svc/prometheus-server 9090:9090running in another terminal:Expected:curl -s http://localhost:9090/api/v1/rules | jq '[.data.groups[].rules[] | select(.name | startswith("PodLogs")) | .health]' curl -s -G http://localhost:9090/api/v1/query --data-urlencode 'query=sum by (pod) (rate(loki_write_sent_entries_total[5m]))'["ok","ok"]from the first command;- one non-zero series per
alloy-logspod from the second.
- Neither alert is firing on a healthy cluster. Verified with
curl -s http://localhost:9090/api/v1/alerts | jq '[.data.alerts[] | select(.labels.alertname | startswith("PodLogs"))] | length'printing0.
- The rules sit next to Alerts fire into nothing: no Alertmanager, and k3s false positives #549's rules. A gate test asserts their names, expressions and
- Key questions:
- Which signal? Alloy's own
loki.writecounters peralloy-logspod (proposed):loki_write_sent_entries_totalandloki_write_dropped_entries_total. They name the node whose shipper failed, which an ingest rate on the Loki side can't. Confirm the series names against the scraped metrics before writing the rules. - Where are the rules defined? With the same file and mechanism as Alerts fire into nothing: no Alertmanager, and k3s false positives #549's rules (proposed), so there is one rule source.
- Can a quiet node fire
PodLogsNotShippedfalsely? It can, if no pod on the node logs for 30 minutes (proposed). Check a week ofrate()once the scrape exists. If a node proves quiet, raiseforrather than drop the rule. - Does a node in planned maintenance page? No. Alerts fire into nothing: no Alertmanager, and k3s false positives #549's maintenance silence covers it (proposed).
- Which signal? Alloy's own
- Constraint:
- Gate tests touch no cluster or network. Each runs in under 1 s and uses structural tuple assertions (test(cli): retire the tuple-assert mandate and detect opaque tuple asserts and presence-only tests #851).
- No new dependency.
Strategic Alignment
- Milestone: backlog, until Alerts fire into nothing: no Alertmanager, and k3s false positives #549 and Metrics for the rest of the platform #551 are placed.
- Depends on: fix(k8s): pod logs reach loki once and labelled, with alloy as the only shipper (remove fluent-bit) #548, Alerts fire into nothing: no Alertmanager, and k3s false positives #549, Metrics for the rest of the platform #551.
- Related: Metrics and logs are kept for two hours #550 (an alert before Loki's volume fills needs the same Loki scrape).
Split off #548 during the v0.2.25/v0.2.26 readiness review (2026-10-01): #548 drops the runtime half of its original "check or alert" deliverable. An alert needs log-pipeline metrics in Prometheus (#551) and a receiver (#549), and both are in the backlog. Without this item, a stopped shipper goes unnoticed.
Monitoring cleanup amendment (2026-10-03): dependency update
The dependency on #551 for the scrapes is replaced: this item depends on #1131, which scrapes the Alloy collectors through integrations.alloy (bringing in loki_write_sent_entries_total and loki_write_dropped_entries_total, plus a drop alert), and on #1130 for Loki's own series (integrations.loki). The alert rules stay in this item.
#1133 disables the Loki canary. If a Loki write and read probe is still wanted, this item re-enables it with lokiCanary.push: false, a scrape of port 3500, a logging-policy rule admitting monitoring on 3500, and an alert on increase(loki_canary_missing_entries_total[15m]) > 0.
Grouping. This item is a child of #1128 and lands right after #1131.
Update 2026-10-08: refinement
#548 and #549 landed (rules in k8s/monitoring/prometheus-values.yaml:146-148). Rules may use only served series (tests/test_k8s_monitoring_alerting.py:31-75), so #1131 serves loki_write_sent_entries_total. A node silence needs a node label, joined from kube_pod_info if missing. PodLogsDropped duplicates #1131's AlloyLogEntriesDropped; keep only PodLogsNotShipped.
Proposed design
Problem statement
The Alloy 'alloy-logs' DaemonSet is the only component that ships pod logs to Loki, but there's no alerting mechanism to detect when it stops sending logs or drops entries. This means that if the shipper fails due to API egress loss, crash-looping, or Loki rejecting pushes, nothing reports this failure.
Acceptance criteria
- Criterion 1: Two Prometheus alert rules are defined and placed next to Alerts fire into nothing: no Alertmanager, and k3s false positives #549's rules: 'PodLogsNotShipped' and 'PodLogsDropped'.
Verification: A gate test asserts their names, expressions and 'for' durations as one structural tuple. Verified by 'uv run pytest' on that test: under 1 s, with no cluster or network. - Criterion 2: The rules are properly scraped by Prometheus and can be queried.
Verification: A person checks on homelab-k3s, with 'kubectl --context homelab-k3s port-forward -n monitoring svc/prometheus-server 9090:9090' running in another terminal. The commands 'curl -shttp://localhost:9090/api/v1/rules| jq '[.data.groups[].rules[] | select(.name | startswith("PodLogs")) | .health]' and 'curl -s -Ghttp://localhost:9090/api/v1/query--data-urlencode 'query=sum by (pod) (rate(loki_write_sent_entries_total[5m]))'' return expected results: '["ok","ok"]' from the first command and one non-zero series per 'alloy-logs' pod from the second. - Criterion 3: Neither alert fires on a healthy cluster.
Verification: Verified with 'curl -shttp://localhost:9090/api/v1/alerts| jq '[.data.alerts[] | select(.labels.alertname | startswith("PodLogs"))] | length'' printing '0'.
Key questions
- Which signal should be used for the alerting?: Alloy's own 'loki.write' counters per 'alloy-logs' pod (proposed): 'loki_write_sent_entries_total' and 'loki_write_dropped_entries_total'. They name the node whose shipper failed, which an ingest rate on the Loki side can't. [sources: k8s/monitoring/k8s-monitoring-values.yaml:70-72, k8s/monitoring/k8s-monitoring-values.yaml:142-154]
- Where are the rules defined?: With the same file and mechanism as Alerts fire into nothing: no Alertmanager, and k3s false positives #549's rules (proposed), so there is one rule source. [sources: k8s/monitoring/prometheus-values.yaml]
- Can a quiet node fire 'PodLogsNotShipped' falsely?: It can, if no pod on the node logs for 30 minutes (proposed). Check a week of 'rate()' once the scrape exists. If a node proves quiet, raise 'for' rather than drop the rule. [sources: k8s/monitoring/k8s-monitoring-values.yaml:70-72]
- Does a node in planned maintenance page?: No. Alerts fire into nothing: no Alertmanager, and k3s false positives #549's maintenance silence covers it (proposed). [sources: k8s/monitoring/k8s-monitoring-values.yaml:70-72]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 17, 2026
Moved to v0.2.37: v0.2.37 started with fewer than its 16 items and was topped up to 16 from Ready items, critical fixes and P0 features first. (devops roadmap reprioritize)
dan-petty commentedon Oct 18, 2026
Status set to Ready at 25e2cda (see proposed design in issue body).
dan-petty commentedon Oct 21, 2026
What changed
#1780, merged into
release/v0.2.38as 6ac07af.4 file(s) changed.
How it was verified
Check runs at a3cc0f9:
No task file.