Skip to content

Fix dbi ipv6 localhost#2192

Open
Paamicky wants to merge 3 commits into
mainfrom
fix-dbi-ipv6-localhost
Open

Fix dbi ipv6 localhost#2192
Paamicky wants to merge 3 commits into
mainfrom
fix-dbi-ipv6-localhost

Conversation

@Paamicky

@Paamicky Paamicky commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description of the issue

When customers configure Database Insights with an IPv6 loopback endpoint ([::1]:5432), the isLocalhostEndpoint function does not recognize the bracketed IPv6 format as a local address. This causes the agent to attempt an SSL connection to localhost, which fails with pq: SSL is not enabled on the server when PostgreSQL does not have SSL configured.

Description of changes

Added [::1] to the isLocalhostEndpoint check in the DBI translator. This ensures IPv6 loopback addresses in the standard bracket notation are correctly identified as localhost.

Agent config

{
  "agent": {
    "region": "us-east-1"
  },
  "opentelemetry": {
    "collect": {
      "database_insights": {
        "postgresql": [
          {
            "endpoint": "[::1]:5432",
            "instance_name": "ipv6-test",
            "username": "cw_monitor",
            "password_file": "/opt/databaseinsights/.pgpass"
          }
        ]
      }
    }
  }
}

Tests

  • Updated TestIsLocalhostEndpoint with [::1]:5432 test case
  • Manually validated on EC2 instance: configured DBI with "endpoint": [::1]:5432, confirmed the agent connects to PostgreSQL over IPv6 without SSL errors and scrapes metrics successfully

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Paamicky Paamicky self-assigned this Jul 9, 2026
@Paamicky Paamicky added the ready for testing Indicates this PR is ready for integration tests to run label Jul 9, 2026
@Paamicky Paamicky marked this pull request as ready for review July 9, 2026 21:19
@Paamicky Paamicky requested a review from a team as a code owner July 9, 2026 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for testing Indicates this PR is ready for integration tests to run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant