Skip to content

Updates to connection strings are never applied to existing gatherers #1085

@0xgouda

Description

@0xgouda

Describe the bug
Any update to a source's connection string (e.g., param change, pointing to a different database, etc.) is never applied to already started gatherers

To Reproduce
Steps to reproduce the behavior:

  1. Update reaper.go:506 to show the conn str in the logs l.WithField("cache", fromCache).WithField("rows", len(data)).WithField("conn_str", md.ConnStr).Info("measurements fetched")
  2. Run pgwatch with a single source and some metrics
  3. Update the conn str of the used source
  4. Observe that the old gatherers will keep using the old conn str

Expected behavior
Should we allow updating the conn str of a source? If we should, this is a bug; if we shouldn't, we should disallow it from the web UI at least and mention it in the documentation.

Screenshots
two metrics for a single source fetching from 2 different databases because one of them is still using the old conn str:

2025-12-18 16:40:37.626 [INFO] [source:test] [metric:db_size] [rows:1] [cache:false] [conn_str:postgresql://postgres:postgres@localhost:5437/postgres] measurements fetched
2025-12-18 16:40:42.603 [INFO] [source:test] [metric:wal] [rows:1] [cache:true] [conn_str:postgresql://postgres:postgres@localhost:5437/pgwatch_metrics] measurements fetched

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconfigConfiguration store relatedsourcesWhat sources and in what way to monitor

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions