[postgres] Allow 'host' config value be UNIX socket path #2734
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The PostgreSQL check has been changed to try to connect to the PostgreSQL database via a UNIX socket if the hostname provided in the configuration begins with a forward-slash ('/').
This behaviour is similar to the 'psql' command-line utility. From
psql(1)
:With the difference being that we interpret it as an exact path, whereas psql interprets it as a directory to look for a socket with a particularly formatted name.
This addresses issue #2361. Arguably, a new configuration parameter,
unix_sock
or similar, should be added. I chose to do it this way as it touches less code, and is, as mentioned above, similar to howpsql
does things.The documentation at
Datadog/documentation/content/integrations/postgresql.md
should also be updated with the new content ofpostgres.yaml.example
.