-
Notifications
You must be signed in to change notification settings - Fork 5.8k
postgresql_extensible reports wrong database name #9735
Copy link
Copy link
Labels
bugunexpected problem or unintended behaviorunexpected problem or unintended behaviorhelp wantedRequest for community participation, code, contributionRequest for community participation, code, contributionsize/m2-4 day effort2-4 day effort
Description
Relevant telegraf.conf:
[[inputs.postgresql_extensible]]
address = "database=foo"
databases = ["foo"]
[[inputs.postgresql_extensible.query]]
sqlquery = "select 1"System info:
Docker
Steps to reproduce:
- Run the above configuration
Expected behavior:
A metric should be emitted with the tag db=foo
Actual behavior:
The metric is emitted with the tag db=postgres
Additional info:
Apparently postgres is a hard-coded value when the statement you are executing does not return a datname field.
This is wrong by all accounts as neither the db in the connection string, nor the db in the database list is postgres. In addition, this behavior (of relying on the datname column) is completely undocumented, and I had to go digging through the source to find out what was going on.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugunexpected problem or unintended behaviorunexpected problem or unintended behaviorhelp wantedRequest for community participation, code, contributionRequest for community participation, code, contributionsize/m2-4 day effort2-4 day effort