这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@kadaffy
Copy link

@kadaffy kadaffy commented Aug 21, 2025

According to the documentation the option to auto discover all databases is enabled by default, however, it is not.

Performed the following tests:

Service started without specifying PG_EXPORTER_AUTO_DISCOVERY (assumed it is enable):

│ time=2025-08-21T07:19:09.430Z level=INFO msg="pg_exporter for postgresql:///?sslmode=disable start, listen on :9187/metrics"                                                                 │
│ time=2025-08-21T07:19:09.431Z level=INFO msg="Listening on" address=[::]:9630                                                                                                                │
│ time=2025-08-21T07:19:09.431Z level=INFO msg="TLS is disabled." http2=false address=[::]:9630                                                                                                │
│ time=2025-08-21T07:19:29.469Z level=INFO msg="server [monitoring] planned with 42 queries, 23 installed, 19 discarded, installed: ...
...

Service started specifying PG_EXPORTER_AUTO_DISCOVERY=true:

time=2025-08-21T07:39:20.196Z level=INFO msg="server [postgresql:///?sslmode=disable] version changed: from [0] to [150014]"                                                                 │
│ time=2025-08-21T07:39:20.230Z level=INFO msg="server [postgresql:///?sslmode=disable] datname changed: from [] to [monitoring]"                                                              │
│ time=2025-08-21T07:39:20.231Z level=INFO msg="spawn new server for database backup : postgresql:///backup?sslmode=disable"                                                                   │
│ time=2025-08-21T07:39:20.231Z level=INFO msg="database backup is installed due to auto-discovery"                                                                                            │
│ time=2025-08-21T07:39:20.231Z level=INFO msg="spawn new server for database demo : postgresql:///demo?sslmode=disable"                                                                       │
│ time=2025-08-21T07:39:20.231Z level=INFO msg="database demo is installed due to auto-discovery"                                                                                              │
│ time=2025-08-21T07:39:20.231Z level=INFO msg="skip database change: add postgres according to in excluded database list"                                                                     │
│ time=2025-08-21T07:39:20.236Z level=INFO msg="pg_exporter for postgresql:///?sslmode=disable start, listen on :9187/metrics"                                                                 │
│ time=2025-08-21T07:39:20.237Z level=INFO msg="Listening on" address=[::]:9630                                                                                                                │
│ time=2025-08-21T07:39:20.238Z level=INFO msg="TLS is disabled." http2=false address=[::]:9630                                                                                                │
│ time=2025-08-21T07:39:23.049Z level=INFO msg="server [monitoring] planned with 42 queries, 23 installed, 19 discarded, installed: pg_wal_14, pg_checkpointer_10, pg_db_14, pg_slot_14, pg_ac │
│ time=2025-08-21T07:39:23.172Z level=INFO msg="server [demo] version changed: from [0] to [150014]"
│ time=2025-08-21T07:39:23.198Z level=INFO msg="server [demo] planned with 42 queries, 1 installed, 41 discarded, installed: ...
│ time=2025-08-21T07:39:23.255Z level=INFO msg="server [backup] version changed: from [0] to [150014]"                                                                                         │
│ time=2025-08-21T07:39:23.280Z level=INFO msg="server [backup] planned with 42 queries, 1 installed, 41 discarded, installed: pg_func , discarded: ...

Test were made just to check the which default value was getting for the PG_EXPORTER_AUTO_DISCOVERY parameter and the default value is set to false.

Links to documentation where it is marked as the default value:

In order to be in sync with the documentation, this PR change the default value in the code to 'true' for the parameter PG_EXPORTER_AUTO_DISCOVERY

Test environment:

Kubernetes provider: kind (1.30.13)
Postgres Deployment: Zalando's Operator
Postgres Version: 15
pg_exporter version: 1.0.1

@kadaffy kadaffy force-pushed the fix/autodiscovery_databases_default_value branch from e915e43 to bc0ea84 Compare August 21, 2025 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant