Skip to content

Commit 4e63e79

Browse files
authored
Avoid overwriting AWS cloud_metadata (#20774)
* Avoid overwriting AWS cloud_metadata * Changelog * Fix * Retry wal stats more times
1 parent 9aef347 commit 4e63e79

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

postgres/changelog.d/20774.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed a bug where the AWS configuration was overwritten for the Postgres integration

postgres/datadog_checks/postgres/postgres.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,8 @@ def set_resource_tags(self):
203203
# allow for detecting if the host is an RDS host, and emit
204204
# the resource properly even if the `aws` config is unset
205205
self.tags.append("dd.internal.resource:aws_rds_instance:{}".format(self.resolved_hostname))
206-
self.cloud_metadata["aws"] = {
207-
"instance_endpoint": self.resolved_hostname,
208-
}
206+
self.cloud_metadata["aws"] = self.cloud_metadata.get("aws", {})
207+
self.cloud_metadata["aws"]["instance_endpoint"] = self.resolved_hostname
209208
if self.cloud_metadata.get("azure") is not None:
210209
deployment_type = self.cloud_metadata.get("azure")["deployment_type"]
211210
# some `deployment_type`s map to multiple `resource_type`s

postgres/tests/test_pg_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ def test_wal_stats(aggregator, integration_check, pg_instance, is_aurora):
619619
cur.execute("insert into persons (lastname) values ('test');")
620620

621621
# Wait for pg_stat_wal to be updated
622-
for _ in range(10):
622+
for _ in range(50):
623623
with conn.cursor() as cur:
624624
cur.execute("select wal_records, wal_bytes from pg_stat_wal;")
625625
new_wal_records = cur.fetchall()[0][0]

0 commit comments

Comments
 (0)