Skip to content

Updates to preset intervals are not applied in some scenarios #1091

@0xgouda

Description

@0xgouda

Describe the bug
In some scenarios (source config update), updates to a preset's metric fetching interval are not applied to running gatherers

To Reproduce
Steps to reproduce the behavior:

  1. Run pgwatch with some preset, e.g., basic
  2. Update the fetching interval for any metric in basic
  3. Update the monitored source and add a standby preset.
  4. Observe that the update to the fetching interval will never get applied

Expected behavior
Updates to metric fetching intervals should be applied.

Additional context
This happens because the update that added the standby preset, although not used anywhere, will cause md.Equal() in:

if md.Equal(newMD.Source) {
// replace with the existing connection if the source is the same
newSrcs[i] = md
continue
}
}
r.monitoredSources = newSrcs

to be false, hence dropping the old *SourceConn of that source from r.monitoredSources and use a new one, but the running gatherer will keep looking for updates from the old *SourceConn which has been dropped and will never get updated.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions