Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
test(monitoring): exercise replacement drains without fixture contention
pulse-triage[bot]65179411cd68
diff --git a/internal/monitoring/poll_providers.go b/internal/monitoring/poll_providers.goindex ff38c2fc86..7768277c14 100644--- a/internal/monitoring/poll_providers.go+++ b/internal/monitoring/poll_providers.go@@ -858,12 +858,21 @@ func (m *Monitor) captureResourceStoreBinding() resourceStoreBinding {}binding.providers.manual = make(map[unifiedresources.DataSource]MonitorSupplementalRecordsProvider, len(m.supplementalProviders))for source, provider := range m.supplementalProviders {- if provider != nil {- binding.providers.manual[source] = provider+ normalized := unifiedresources.DataSource(strings.ToLower(strings.TrimSpace(string(source))))+ if provider != nil && normalized != "" {+ binding.providers.manual[normalized] = provider}}m.mu.RUnlock()+ // Registration validates types, but keep bare-monitor fixture behavior+ // without invoking a provider method while holding m.mu.+ if provider := byType[""]; provider != nil {+ delete(byType, "")+ if typ := provider.Type(); typ != "" {+ byType[typ] = provider+ }+ }for _, provider := range []PollProvider{newPVEPollProvider(), newPBSPollProvider(), newPMGPollProvider(), newAvailabilityPollProvider()} {typ := provider.Type()if _, exists := byType[typ]; !exists {diff --git a/internal/monitoring/resource_publication_ownership_test.go b/internal/monitoring/resource_publication_ownership_test.goindex b612fe4fae..239404ae1a 100644--- a/internal/monitoring/resource_publication_ownership_test.go+++ b/internal/monitoring/resource_publication_ownership_test.go@@ -39,7 +39,7 @@ func (p *consumeOnceWiringProvider) SupplementalChanges(m *Monitor, org string)}p.pending = falsep.drains++- return []unifiedresources.ResourceChange{{ResourceID: p.name, ResourceName: p.name, OrgID: org}}+ return []unifiedresources.ResourceChange{{ResourceID: p.name, Metadata: map[string]any{"org": org}}}}func (p *consumeOnceWiringProvider) drainCount() int {@@ -58,6 +58,14 @@ func newWiringChangeStore() *wiringChangeStore {return &wiringChangeStore{wiringPublicationStore: newWiringPublicationStore()}}+func (s *wiringChangeStore) TryReplaceRegistryForRead(snapshot models.StateSnapshot, maxAge time.Duration, supply func() map[unifiedresources.DataSource][]unifiedresources.IngestRecord) bool {+ rebuilt := s.MonitorAdapter.TryReplaceRegistryForRead(snapshot, maxAge, supply)+ if rebuilt && s.before != nil {+ s.before()+ }+ return rebuilt+}+func (s *wiringChangeStore) RecordChange(change unifiedresources.ResourceChange) error {s.changeMu.Lock()defer s.changeMu.Unlock()@@ -88,12 +96,13 @@ type changeSelectionBarrier struct {published *atomic.Boolentered chan struct{}release chan struct{}- once sync.Once+ held atomic.Bool}func (p *changeSelectionBarrier) hold() {- if p.published.Load() {- p.once.Do(func() { close(p.entered); <-p.release })+ if p.published.Load() && p.held.CompareAndSwap(false, true) {+ close(p.entered)+ <-p.release}}@@ -123,13 +132,7 @@ func TestResourcePublicationChangesStayWithTheirCapturedStoreAndProvider(t *testnewProvider := &consumeOnceWiringProvider{name: "new-host", pending: true}var published atomic.Boolbarrier := &changeSelectionBarrier{published: &published, entered: make(chan struct{}), release: make(chan struct{})}- // Read refresh uses the native MonitorAdapter; for it the first- // post-publication callback itself is the unambiguous boundary.- if read {- oldProvider.beforeChanges = func(*Monitor) { published.Store(true); barrier.hold() }- } else {- oldStore.before = func() { published.Store(true) }- }+ oldStore.before = func() { published.Store(true) }m := &Monitor{state: models.NewState(), resourceStore: oldStore,pollProviders: map[InstanceType]PollProvider{"barrier": barrier},supplementalProviders: map[unifiedresources.DataSource]MonitorSupplementalRecordsProvider{unifiedresources.SourceTrueNAS: oldProvider}}