Skip to content

fix: the error alert lists each kind of error, scanner 404s stop counting as errors, and nginx sees the visitor's address behind Cloudflare - #461

Merged
HardMax71 merged 1 commit into
mainfrom
max/error-alerts
Oct 24, 2026
Merged

HardMax71 merged 1 commit into
mainfrom
max/error-alerts

Conversation

@HardMax71

Copy link
Copy Markdown
Owner

Summary

The Error lines alert from #449 mailed A=23 C=1 five times since Oct 23, never saying what failed. All 28 lines were scanners asking for files the app never had (/wp-includes/css/buttons.css), and nginx logs each one as [error].

Changes

nginx gets log_not_found off, so a missing file is just a 404. It takes the visitor's address from CF-Connecting-IP on connections from Cloudflare's ranges and sends only that upstream. Before, everyone behind one Cloudflare server shared one rate limit, and the backend read an X-Forwarded-For entry a client could forge.

The collector's drain processor gives each error line a template like open() <*> failed (2: No such file or directory). Error lines groups by service and template, so the mail reads "16 errors in the last 5 minutes:", then "10x frontend: ..." per template and a link to the latest lines. Rules with a panel also get __dashboardUid__ and __panelId__, the only way Grafana links a panel in mails.

Note

Port 5001 still answers anyone until the Hetzner firewall that admits only Cloudflare's ranges is applied; that is a change on the server, not in this repo.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or tooling changes

Test Plan

  • Backend unit tests pass (cd backend && uv run pytest tests/unit)
  • Frontend unit tests pass (cd frontend && npm run test)
  • Backend E2E tests pass (docker compose exec -T backend sh -c 'uv sync --group test --no-dev --frozen --no-install-project --no-build && pytest tests/e2e')
  • Frontend E2E tests pass (cd frontend && npm run test:e2e)
  • API spec and client regenerated if routes or schemas changed (uv run python -m scripts.export_openapi in backend/, then npm run generate:api in frontend/), never edited by hand
  • Manual testing performed

Validation: a throwaway stack from this branch mailed that format for nginx and worker errors. Scanner paths logged no error line, and forged headers from a non-Cloudflare peer were dropped. Drain grouped 22 prod error lines from six services; mkdocs build --strict passes.

Checklist

  • My code follows the project's style guidelines
  • I have run pre-commit run --all-files and all checks pass
  • I have added tests that prove my fix/feature works
  • I have updated documentation if needed
  • My changes don't introduce new warnings

…ting as errors, and nginx sees the visitor's address behind Cloudflare
@HardMax71
HardMax71 enabled auto-merge (squash) October 24, 2026 21:46
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 24, 2026
@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1e3b392e-c170-4b9a-80a7-c68a03e6d154
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added area: frontend Svelte UI and the generated API client area: observability Metrics, dashboards, alerts, logs, traces, OTel collector labels Oct 24, 2026
@sonarqubecloud

Copy link
Copy Markdown

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Flag Coverage Δ
frontend-unit 92.25% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend 94.73% <ø> (ø)
Frontend 92.25% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@HardMax71
HardMax71 merged commit 031bff1 into main Oct 24, 2026
23 checks passed
@HardMax71
HardMax71 deleted the max/error-alerts branch October 24, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: frontend Svelte UI and the generated API client area: observability Metrics, dashboards, alerts, logs, traces, OTel collector documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants