mirror of
https://github.com/amir20/dozzle.git
synced 2026-06-23 04:10:12 +00:00
a79ffdaf50
Co-authored-by: Dhaval Patel <dhavu262@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1.6 KiB
1.6 KiB
Bug Hunter Agent Memory
Codebase Patterns
Notification System Architecture
notification.Managerowns subscriptions (xsync.Map) and dispatchers (xsync.Map)- Two processing goroutines:
processLogEventsandprocessStatEventsstarted inNewManager - Stats listener has start/stop lifecycle; log listener is always-on once started
MultiHostServicewraps Manager and handles config persistence + agent broadcast
Known Bug-Prone Areas
- broadcastNotificationConfig: Has historically missed fields when converting between internal and types packages (APIKey, Prefix, ExpiresAt were missed)
- TriggeredContainerIDs lazy init: Race condition risk - initialized lazily in AddTriggeredContainer without sync
- Channel close handling: enrich() in stats_listener doesn't check for closed channel, can hot-spin
- LogAlertFields canSave: Allows empty logExpression (no error = valid), creates dead subscriptions
Type Mapping Gotchas
container.ContainerStat->types.NotificationStat: field names differ (CPUPercent vs cpu expr tag)notification.DispatcherConfig->types.DispatcherConfig: must copy ALL fields including APIKey, Prefix, ExpiresAt- Frontend
NotificationRule.cooldownis optional, backend defaults to 300 viaGetCooldownSeconds()
Concurrency Model
- xsync.Map used throughout for concurrent access (subscriptions, dispatchers, activeStreams, containers)
- Subscription fields use atomic types: TriggerCount (atomic.Int64), LastTriggeredAt (atomic.Pointer)
- MetricCooldowns uses xsync.Map for per-container cooldown tracking
- sendSem (semaphore.Weighted=5) limits concurrent notification sends