Repository navigation
Description
Problem
Crawl4AI is a heavy pod (Chromium, 2.3 GB image) with a record of 14 or more advisories in 5 months. If it is down or if it fails often, the refine and alternatives jobs lose their page text without a visible sign. The Firecrawl search already has alerts on devops_cli_firecrawl_searches_total in k8s/monitoring/prometheus-values.yaml; the fetch has none.
Expected
Alert rules in k8s/monitoring/prometheus-values.yaml: (1) the error ratio of devops_cli_crawl4ai_fetches_total over one hour above a limit, with a minimum count so that one failure does not fire; (2) the Deployment crawl4ai has no ready replica for 15 minutes, if kube-state-metrics runs (check first; if not, rule 1 only). The alerts follow the shape of the Firecrawl alerts. k8s/README.md lists them.
Acceptance criteria
- The existing promtool and rule tests fail on the base for the new rules and pass with them (a rule test with a synthetic series that fires and one that does not).
- The alert text names the counter label and the log command, and holds no secret.
- The rule does not fire when
crawl4ai.urlis unset (no series).
Existing tool considered
Prometheus rules in the existing values file, promtool. No new tool.
Related
Related: the manifests issue and the client issue (the counter). Do not scrape Crawl4AI's own /metrics: it needs the token.
Proposed design
Problem statement
Crawl4AI is a heavy pod with a history of security advisories. If it fails, the refine and alternatives jobs lose page text with no visible sign. The Firecrawl search has alerts, but the Crawl4AI fetch has none. Add two Prometheus alert rules, their promtool tests, and the README rows.
Acceptance criteria
Requirement: crawl4ai-fetch-error-alert
The crawl4ai rule group SHALL fire Crawl4aiFetchErrors when the ratio of non-ok results to all devops_cli_crawl4ai_fetches_total results over one hour is above 0.2 and the total is at least 5.
Scenario: Frequent fetch failures fire
- WHEN A synthetic
devops_cli_crawl4ai_fetches_total{job="roadmap-service",result="ok"}series has 3 and aresult="error"series has 2 in one hour. - THEN
promtool test rulesreportsCrawl4aiFetchErrorsfiring with the expected labels and annotations.
Requirement: crawl4ai-fetch-error-quiet
Crawl4aiFetchErrors SHALL NOT fire when the total fetches in one hour is below 5 or the error ratio is 0.2 or less.
Scenario: One failure stays quiet
- WHEN A synthetic series has 4
okresults and 1errorresult in one hour. - THEN
promtool test rulesreports noCrawl4aiFetchErrorsalert.
Requirement: crawl4ai-no-series-quiet
Crawl4aiFetchErrors SHALL NOT fire when devops_cli_crawl4ai_fetches_total has no series.
Scenario: Crawl4AI URL is unset
- WHEN The rule test supplies no
devops_cli_crawl4ai_fetches_totalseries. - THEN
promtool test rulesreports noCrawl4aiFetchErrorsalert.
Requirement: crawl4ai-unavailable-alert
The crawl4ai rule group SHALL fire Crawl4aiUnavailable when kube_deployment_status_replicas_available{namespace="devops",deployment="crawl4ai"} is below 1 for 15 minutes.
Scenario: No ready replica fires
- WHEN A synthetic
kube_deployment_status_replicas_availableseries fordevops/crawl4aistays at 0 for 15 minutes. - THEN
promtool test rulesreportsCrawl4aiUnavailablefiring with the expected labels and annotations.
Requirement: crawl4ai-alert-text
The annotations of Crawl4aiFetchErrors and Crawl4aiUnavailable SHALL name the counter or Deployment and the log command, and SHALL contain no token or secret.
Scenario: Annotations name the cause and the log
- WHEN The rule tests render the annotations of both alerts.
- THEN The fetch annotation contains
devops_cli_crawl4ai_fetches_totalandresult; both annotations containkubectl -n devops logs deploy/crawl4ai; neither containsCRAWL4AI_API_TOKEN.
Requirement: crawl4ai-rule-test-pin
The alerting test SHALL pin the crawl4ai group and its test file, so the test fails on the base commit and passes with the rules.
Scenario: Rule test fails on base
- WHEN
tests/test_k8s_monitoring_alerting.pyruns on the base commit and on the change. - THEN It fails on the base commit and passes on the change.
Requirement: crawl4ai-readme-alerts
k8s/README.md SHALL list Crawl4aiFetchErrors and Crawl4aiUnavailable in its Alerting table.
Scenario: README lists both alerts
- WHEN The Alerting table in
k8s/README.mdis read. - THEN It has one row for
Crawl4aiFetchErrorsand one forCrawl4aiUnavailablewith their fire conditions.
Requirement: crawl4ai-no-metrics-scrape
The change SHALL NOT add a scrape target or ServiceMonitor for Crawl4AI's /metrics endpoint.
Scenario: No new scrape target
- WHEN The rendered Prometheus scrape configuration and k8s-monitoring values are checked.
- THEN No scrape target names
crawl4aior port11235.
Existing Tool Considered
No alternatives check has run. Prometheus alerting rules and the pinned promtool cover the need. The tool has no built-in Crawl4AI alert, so the change writes two rule expressions and their tests. No new tool or application code is needed.
Key questions
- Which counter and label identify a failed Crawl4AI fetch?:
devops_cli_crawl4ai_fetches_totalcounts each fetch byresult. The valueokis a success. Every other value is an HTTP status orerror. [sources: docs/TELEMETRY.md:94, src/devops_cli/telemetry/instruments.py, openspec/changes/archive/2026-11-07-3887-crawl4ai-page-text/specs/crawl4ai-page-text/spec.md:24] - Does kube-state-metrics run, so the Deployment rule can use its series?: Yes. k8s-monitoring deploys kube-state-metrics. Existing rules read
kube_deployment_status_replicas_available. [sources: k8s/README.md, k8s/monitoring/prometheus-values.yaml] - Which expression and threshold detect frequent fetch failures?: Use the ratio of non-
okresults to all results over one hour. Fire when the ratio is above 0.2 and the total is at least 5. Selectjob="roadmap-service". (best practice) [sources: k8s/monitoring/prometheus-values.yaml, docs/TELEMETRY.md:94]- Chosen: Ratio over 1h with minimum 5. One failure in five is 20% and does not fire. Two failures in five fire. The 1-hour window smooths low volume.
- Rejected: Absolute error count. A count of 1 fires on one failure. It also hides a high error ratio at low volume.
- Rejected: Any non-ok fetch. One failed fetch fires, which the issue forbids.
- Which expression detects a Crawl4AI Deployment with no ready replica?: Use
kube_deployment_status_replicas_available{namespace="devops", deployment="crawl4ai"} < 1for 15 minutes. (best practice) [sources: k8s/monitoring/prometheus-values.yaml, k8s/README.md]- Chosen: Available replicas below 1. It matches the issue wording and the existing Mattermost rule.
- Rejected: Unavailable replicas above 0. It fires during a normal Recreate rollout while a replica still serves.
- Which severity and pending period should each rule use?: Use severity
warningfor both rules. Usefor: 10mforCrawl4aiFetchErrorsandfor: 15mforCrawl4aiUnavailable. (best practice) [sources: k8s/monitoring/prometheus-values.yaml, k8s/README.md]- Chosen: warning, 10m and 15m. Page text loss degrades refinement but does not stop the Service. The 15m matches the issue.
- Rejected: critical, 0m and 15m. It pages for a degraded page-text path and ignores the 1-hour ratio window.
- Where should the rules live and how should the tests run?: Add a
crawl4aigroup underserverFiles.alerting_rules.yml. Addtests/fixtures/prometheus_rules/crawl4ai_tests.yaml. Pin the group and its test file intests/test_k8s_monitoring_alerting.py. (best practice) [sources: k8s/monitoring/prometheus-values.yaml, k8s/README.md]- Chosen: New crawl4ai group and test file. The alerts concern the Crawl4AI dependency, not one roadmap row. The existing test runner discovers a group from its pinned test file.
- Rejected: Add to roadmap-service-activity. It mixes the Crawl4AI dependency health with the Service's own write activity.
- Should the change scrape Crawl4AI's own
/metrics?: No. The client counter and kube-state-metrics cover both alerts. Crawl4AI's/metricsneeds the bearer token. (best practice) [sources: k8s/README.md, docs/TELEMETRY.md:94]- Chosen: Use client counter and kube-state-metrics. It needs no token and adds no scrape.
- Rejected: Scrape Crawl4AI
/metrics. The endpoint needs the bearer token, and the issue forbids the scrape.
- Does
Crawl4aiFetchErrorsfire whencrawl4ai.urlis unset?: No. With no URL, the client sends no fetch and the counter has no series. The ratio expression then returns no vector. [sources: k8s/README.md, docs/TELEMETRY.md:94] - What should the alert annotations say?: The fetch alert names
devops_cli_crawl4ai_fetches_totaland itsresultlabel. Both alerts namedeployment/crawl4aiand the commandkubectl -n devops logs deploy/crawl4ai. They hold no token. (best practice) [sources: k8s/monitoring/prometheus-values.yaml, k8s/README.md]- Chosen: Name the counter, deployment and log command. An operator can identify the failed fetch and read the service log without a secret.
- Rejected: Name only the alert name. The operator cannot find the counter or the log.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(k8s)scope of the title gives the scope.Operational visibility for a heavy pod with a known advisory record, but not a blocker for other work.Gives operators a visible signal when Crawl4AI is down or failing, preventing silent loss of page text in refine and alternatives jobs.Two alert rules in an existing values file following the Firecrawl pattern, plus a README line and a synthetic rule test.Both concern the Crawl4AI deployment in k8s; #3884 creates the Deployment and Service while the candidate adds Prometheus alert rules for that Deployment.devops-cli-service commentedon Nov 7, 2026
Status set to Ready at a6fff84 (see proposed design in issue body).
devops-cli-service commentedon Nov 7, 2026
Released in v0.84.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.84.0
devops-cli-service commentedon Nov 7, 2026
Live since 2026-11-07 22:00 UTC