Skip to content

Commit 337323b

Browse files
pierreln-ddclaude
andauthored
[Postgres] Remove incorrect empty_default_hostname warning (DataDog#23082)
* [Postgres] Hide empty_default_hostname and remove incorrect warning The Postgres check uses `exclude_hostname` instead of `empty_default_hostname` for hostname exclusion. However, `empty_default_hostname` was still documented in the example config (inherited from the global template) and the Cluster Agent injects it unconditionally on all cluster checks, causing a confusing warning. This change: - Hides `empty_default_hostname` from the Postgres conf.yaml.example - Removes the warning that fired when the option was set - Removes the associated test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Restore empty_default_hostname in EXPECTED_DEFAULTS The field still exists in InstanceConfig (hidden only affects the example file), so the defaults test requires it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix changelog entry PR number Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix conf.yaml.example: hand-edit removal, restore models to master The old local ddev (v14.0.1) was generating a different format than CI expects. Instead, start from master's conf.yaml.example and only remove the empty_default_hostname block. Restore config models to master state since they should not change for this PR. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Simplify PR: only remove the warning, keep empty_default_hostname in config The option is not completely unused — revert spec.yaml, conf.yaml.example, and model changes. Only remove the warning in config.py and its test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Remove accidentally staged unrelated file Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update changelog wording Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c12e744 commit 337323b

3 files changed

Lines changed: 1 addition & 15 deletions

File tree

postgres/changelog.d/23082.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove `empty_default_hostname` warning. The Cluster Agent injects this option unconditionally on cluster checks, causing a confusing warning that customers cannot prevent.

postgres/datadog_checks/postgres/config.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,6 @@ def validate_config(config: InstanceConfig, instance: dict, validation_result: V
390390
'"dbname" parameter must be set OR autodiscovery must be enabled when using the "relations" parameter.'
391391
)
392392

393-
if config.empty_default_hostname:
394-
validation_result.add_warning(
395-
'The `empty_default_hostname` option has no effect in the Postgres check. '
396-
'Use the `exclude_hostname` option instead.'
397-
)
398-
399393
# Validate dbname is not excluded when using autodiscovery
400394
# Only validate when dbname was NOT explicitly set by the user (auto-defaulted)
401395
# If user explicitly set dbname, they may intentionally want to connect to an excluded database

postgres/tests/test_config.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,6 @@ def test_initialize_deprecated_options_warn(mock_check, minimal_instance):
153153
assert any("deprecated" in w for w in result.warnings)
154154

155155

156-
def test_initialize_empty_default_hostname_warns(mock_check, minimal_instance):
157-
instance = minimal_instance
158-
instance['empty_default_hostname'] = True
159-
mock_check.instance = instance
160-
mock_check.init_config = {}
161-
config, result = build_config(check=mock_check)
162-
assert any("empty_default_hostname" in w for w in result.warnings)
163-
164-
165156
@pytest.mark.parametrize(
166157
'instance, init_config, should_propagate',
167158
[

0 commit comments

Comments
 (0)