How mori-dv/watchtower works
Watchtower is a Go uptime-monitoring service: configured targets are scheduled, probed concurrently, evaluated for state transitions, then surfaced through alerts, metrics, logs, and management endpoints. The README documents the main runtime stages and capabilities; sampled startup code confirms wiring for storage, result processing, reloads, and HTTP routes. The frontend is a separate explanatory site with interactive architecture and observability sections, not a demonstrated live backend client. Some subsystem links rely on README descriptions because their implementation excerpts were not provided.
Main entry points: main.go Service Entrypoint · App.tsx Site Application · checker.go Probe Engine · store.go State Storage
Components 33
Probe Runtime
- Target Config
internal/config/config.go - Scheduler
internal/scheduler/scheduler.go - Worker Pool
internal/worker/pool.go - Retry Backoff
internal/worker/backoff.go - Probe Engine
internal/checker/checker.go - HTTP Checks
internal/checker/http.go - TCP Checks
internal/checker/tcp.go - ICMP Checks
internal/checker/icmp.go
State And Alerts
- State Evaluator
internal/state/evaluator.go - State Storage
internal/storage/store.go - Memory Store
internal/storage/memory.go - Redis Store
internal/storage/redis.go - Alert Manager
internal/alert/manager.go - Alert Dispatchers
internal/alert/dispatcher.go
Operations And Telemetry
- Service Entrypoint
cmd/watchtower/main.go - Management API
internal/api/status.go - Prometheus Metrics
internal/metrics/prometheus.go - Structured Logging
internal/logging/logger.go
Explanatory Frontend
- Site Application
frontend/src/App.tsx - Site Entry
frontend/src/main.tsx - Navigation Header
frontend/src/components/NavigationHeader.tsx - Scroll Indicators
frontend/src/components/ScrollIndicators.tsx - Hero Section
frontend/src/components/SectionHero.tsx - Mechanics Demo
frontend/src/components/SectionMechanics.tsx - Observability Section
frontend/src/components/SectionObservability.tsx - Demo Data
frontend/src/data/mockData.ts
Other components
- Operator
- Notification Services
- Prometheus Scraper
- Grafana Dashboards
observability/grafana/provisioning/dashboards/watchtower.json - Loki Log Store
observability/loki/config.yml - Promtail
observability/promtail/promtail.yml - Mock Server
cmd/mockserver/main.go
Connections 34
- Operator → Target Config: configures
README.md - Target Config → Service Entrypoint: loads config
cmd/watchtower/main.go - Service Entrypoint → Scheduler: starts
cmd/watchtower/main.go - Scheduler → Worker Pool: queues jobs
README.md - Worker Pool → Probe Engine: runs probes
README.md - Probe Engine → HTTP Checks: dispatches
README.md - Probe Engine → TCP Checks: dispatches
README.md - Probe Engine → ICMP Checks: dispatches
README.md - Worker Pool → Retry Backoff: retries with
README.md - Service Entrypoint → State Evaluator: evaluates results
cmd/watchtower/main.go - Service Entrypoint → Prometheus Metrics: updates
cmd/watchtower/main.go - Service Entrypoint → Alert Manager: handles alerts
cmd/watchtower/main.go - Service Entrypoint → Structured Logging: logs results
cmd/watchtower/main.go - Service Entrypoint → Management API: registers routes
cmd/watchtower/main.go - Service Entrypoint → State Storage: selects store
cmd/watchtower/main.go - State Evaluator → State Storage: persists state
README.md - State Storage → Memory Store: implemented by
README.md - State Storage → Redis Store: implemented by
README.md - Alert Manager → State Storage: checks cooldown
internal/alert/manager.go - Alert Manager → Alert Dispatchers: dispatches events
internal/alert/manager.go - Alert Dispatchers → Notification Services: sends alerts
README.md - Prometheus Scraper → Prometheus Metrics: scrapes
README.md - Prometheus Metrics → Grafana Dashboards: visualized in
README.md - Structured Logging → Promtail: collected by
README.md - Promtail → Loki Log Store: ships logs
README.md - Operator → Management API: queries status
README.md - Mock Server → Probe Engine: provides test targets
- Site Entry → Site Application: renders
frontend/src/main.tsx - Site Application → Navigation Header: renders
frontend/src/App.tsx - Site Application → Scroll Indicators: renders
frontend/src/App.tsx - Site Application → Hero Section: renders
frontend/src/App.tsx - Site Application → Mechanics Demo: renders
frontend/src/App.tsx - Site Application → Observability Section: renders
frontend/src/App.tsx - Mechanics Demo → Demo Data: illustrates monitoring