sql_exporter
sql_exporter copied to clipboard
Add posibility to run query on a given connection
Hi,
For our use case, it would be helpful if we have the possibility to run some queries on specific connections.
So we would probably need to extend config to something like thisL
connections:
db1: 'postgres://postgres@localhost/postgres?sslmode=disable'
db2: 'postgres://postgres@localhost/postgres?sslmode=disable'
and add posibility to define db in queries section
queries:
# name is prefied with sql_ and used as the metric name
- name: "running_queries"
- connections:
- db1
I'm willing to contribute. I guess that the most difficult part will be to make the config backward compatible. My proposal is
- create a new section ?
named_connections:
db1: 'postgres://postgres@localhost/postgres?sslmode=disable'
db2: 'postgres://postgres@localhost/postgres?sslmode=disable'
- add somehow the name to the connection string
connections:
- 'db1##postgres://postgres@localhost/postgres?sslmode=disable'
- 'db1##postgres://postgres@localhost/postgres?sslmode=disable'
Hey, wouldn't it be easier to just add a new config block that always has one connection and the query you want to run on that connection? Maybe I'm not understanding the question though.