Closed eri33 closed 3 years ago
can you paste the output of query-exporter running with -L DEBUG
?
Hi,
FYI, I changed slincy the config.yaml file.
Here is the output with -L DEBUG:
[root@slre7900302 ~]# query-exporter /usr/query-exporter-master/query_exporter/schemas/config.yaml -H 0.0.0.0 -L DEBUG |grep sl101712 2021-03-11 19:12:28,391 - INFO - aiohttp.web - Listening on http://0.0.0.0:9560 2021-03-11 19:12:28,391 - INFO - query-exporter - version 2.6.1 starting up 2021-03-11 19:12:28,418 - DEBUG - query-exporter - connected to database "d_ambari_dpgbdhadoop" 2021-03-11 19:12:28,435 - DEBUG - query-exporter - connected to database "postgres_sl101712" 2021-03-11 19:12:28,451 - DEBUG - query-exporter - connected to database "postgres_slre7900302" 2021-03-11 19:12:28,452 - DEBUG - query-exporter - running query "query1" on database "d_ambari_dpgbdhadoop" 2021-03-11 19:12:28,452 - DEBUG - query-exporter - running query "query1" on database "postgres_sl101712" 2021-03-11 19:12:28,452 - DEBUG - query-exporter - running query "query1" on database "postgres_slre7900302" 2021-03-11 19:12:28,457 - DEBUG - query-exporter - disconnected from database "d_ambari_dpgbdhadoop" 2021-03-11 19:12:28,457 - DEBUG - query-exporter - updating metric "metric1" set 4.39496870152652e-16 {app="DATALAKE",database="d_ambari_dpgbdhadoop",region="DEV"} 2021-03-11 19:12:28,457 - DEBUG - query-exporter - updating metric "query_latency" observe 0.00133533775806427 {app="DATALAKE",database="d_ambari_dpgbdhadoop",query="query1",region="DEV"} 2021-03-11 19:12:28,457 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="DATALAKE",database="d_ambari_dpgbdhadoop",query="query1",region="DEV",status="success"} 2021-03-11 19:12:28,457 - DEBUG - query-exporter - disconnected from database "postgres_sl101712" 2021-03-11 19:12:28,457 - DEBUG - query-exporter - updating metric "metric1" set 2.4450555748300573e-16 {app="PN IARD",database="postgres_sl101712",region="DEV"} 2021-03-11 19:12:28,457 - DEBUG - query-exporter - updating metric "query_latency" observe 0.0011701993644237518 {app="PN IARD",database="postgres_sl101712",query="query1",region="DEV"} 2021-03-11 19:12:28,458 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="PN IARD",database="postgres_sl101712",query="query1",region="DEV",status="success"} 2021-03-11 19:12:28,459 - DEBUG - query-exporter - disconnected from database "postgres_slre7900302" 2021-03-11 19:12:28,459 - DEBUG - query-exporter - updating metric "metric1" set 7.777238405041729e-16 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",region="MAQUETTE"} 2021-03-11 19:12:28,459 - DEBUG - query-exporter - updating metric "query_latency" observe 0.0008683539927005768 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",query="query1",region="MAQUETTE"} 2021-03-11 19:12:28,459 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",query="query1",region="MAQUETTE",status="success"} 2021-03-11 19:12:48,469 - DEBUG - query-exporter - connected to database "d_ambari_dpgbdhadoop" 2021-03-11 19:12:48,469 - DEBUG - query-exporter - running query "query1" on database "d_ambari_dpgbdhadoop" 2021-03-11 19:12:48,469 - DEBUG - query-exporter - connected to database "postgres_sl101712" 2021-03-11 19:12:48,470 - DEBUG - query-exporter - running query "query1" on database "postgres_sl101712" 2021-03-11 19:12:48,471 - DEBUG - query-exporter - connected to database "postgres_slre7900302" 2021-03-11 19:12:48,471 - DEBUG - query-exporter - running query "query1" on database "postgres_slre7900302" 2021-03-11 19:12:48,474 - DEBUG - query-exporter - disconnected from database "postgres_sl101712" 2021-03-11 19:12:48,474 - DEBUG - query-exporter - updating metric "metric1" set 1.0650986754954062e-16 {app="PN IARD",database="postgres_sl101712",region="DEV"} 2021-03-11 19:12:48,474 - DEBUG - query-exporter - updating metric "query_latency" observe 0.001135062426328659 {app="PN IARD",database="postgres_sl101712",query="query1",region="DEV"} 2021-03-11 19:12:48,474 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="PN IARD",database="postgres_sl101712",query="query1",region="DEV",status="success"} 2021-03-11 19:12:48,474 - DEBUG - query-exporter - disconnected from database "d_ambari_dpgbdhadoop" 2021-03-11 19:12:48,475 - DEBUG - query-exporter - updating metric "metric1" set 5.33631606958806e-16 {app="DATALAKE",database="d_ambari_dpgbdhadoop",region="DEV"} 2021-03-11 19:12:48,475 - DEBUG - query-exporter - updating metric "query_latency" observe 0.0014905072748661041 {app="DATALAKE",database="d_ambari_dpgbdhadoop",query="query1",region=" 2021-03-11 19:12:48,475 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="DATALAKE",database="d_ambari_dpgbdhadoop",query="query1",region="DEV",status="success"} 2021-03-11 19:12:48,477 - DEBUG - query-exporter - disconnected from database "postgres_slre7900302" 2021-03-11 19:12:48,477 - DEBUG - query-exporter - updating metric "metric1" set 2.729517474027325e-16 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",region="MAQUETTE"} 2021-03-11 19:12:48,477 - DEBUG - query-exporter - updating metric "query_latency" observe 0.0035823844373226166 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",query="query1", 2021-03-11 19:12:48,477 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",query="query1",region="MAQUETTE",status="succ 2021-03-11 19:13:08,470 - DEBUG - query-exporter - connected to database "d_ambari_dpgbdhadoop" 2021-03-11 19:13:08,470 - DEBUG - query-exporter - running query "query1" on database "d_ambari_dpgbdhadoop" 2021-03-11 19:13:08,471 - DEBUG - query-exporter - connected to database "postgres_sl101712" 2021-03-11 19:13:08,471 - DEBUG - query-exporter - running query "query1" on database "postgres_sl101712" 2021-03-11 19:13:08,472 - DEBUG - query-exporter - connected to database "postgres_slre7900302" 2021-03-11 19:13:08,472 - DEBUG - query-exporter - running query "query1" on database "postgres_slre7900302" 2021-03-11 19:13:08,475 - DEBUG - query-exporter - disconnected from database "d_ambari_dpgbdhadoop" 2021-03-11 19:13:08,475 - DEBUG - query-exporter - updating metric "metric1" set 8.35516860708594e-16 {app="DATALAKE",database="d_ambari_dpgbdhadoop",region="DEV"} 2021-03-11 19:13:08,475 - DEBUG - query-exporter - updating metric "query_latency" observe 0.0009423047304153442 {app="DATALAKE",database="d_ambari_dpgbdhadoop",query="query1",region=" 2021-03-11 19:13:08,475 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="DATALAKE",database="d_ambari_dpgbdhadoop",query="query1",region="DEV",status="success"} 2021-03-11 19:13:08,475 - DEBUG - query-exporter - disconnected from database "postgres_sl101712" 2021-03-11 19:13:08,475 - DEBUG - query-exporter - updating metric "metric1" set 4.740628580226378e-16 {app="PN IARD",database="postgres_sl101712",region="DEV"} 2021-03-11 19:13:08,475 - DEBUG - query-exporter - updating metric "query_latency" observe 0.0013022646307945251 {app="PN IARD",database="postgres_sl101712",query="query1",region="DEV" 2021-03-11 19:13:08,475 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="PN IARD",database="postgres_sl101712",query="query1",region="DEV",status="success"} 2021-03-11 19:13:08,477 - DEBUG - query-exporter - disconnected from database "postgres_slre7900302" 2021-03-11 19:13:08,477 - DEBUG - query-exporter - updating metric "metric1" set 7.37155206797965e-16 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",region="MAQUETTE"} 2021-03-11 19:13:08,477 - DEBUG - query-exporter - updating metric "query_latency" observe 0.0031310655176639557 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",query="query1", 2021-03-11 19:13:08,478 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",query="query1",region="MAQUETTE",status="succ 2021-03-11 19:13:28,462 - DEBUG - query-exporter - connected to database "d_ambari_dpgbdhadoop" 2021-03-11 19:13:28,462 - DEBUG - query-exporter - running query "query1" on database "d_ambari_dpgbdhadoop" 2021-03-11 19:13:28,462 - DEBUG - query-exporter - connected to database "postgres_sl101712" 2021-03-11 19:13:28,462 - DEBUG - query-exporter - running query "query1" on database "postgres_sl101712" 2021-03-11 19:13:28,463 - DEBUG - query-exporter - connected to database "postgres_slre7900302" 2021-03-11 19:13:28,463 - DEBUG - query-exporter - running query "query1" on database "postgres_slre7900302" 2021-03-11 19:13:28,466 - DEBUG - query-exporter - disconnected from database "postgres_sl101712" 2021-03-11 19:13:28,466 - DEBUG - query-exporter - updating metric "metric1" set 6.592250386501206e-16 {app="PN IARD",database="postgres_sl101712",region="DEV"} 2021-03-11 19:13:28,466 - DEBUG - query-exporter - updating metric "query_latency" observe 0.0011374391615390778 {app="PN IARD",database="postgres_sl101712",query="query1",region="DEV" 2021-03-11 19:13:28,466 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="PN IARD",database="postgres_sl101712",query="query1",region="DEV",status="success"} 2021-03-11 19:13:28,467 - DEBUG - query-exporter - disconnected from database "d_ambari_dpgbdhadoop" 2021-03-11 19:13:28,467 - DEBUG - query-exporter - updating metric "metric1" set 7.66877793706953e-16 {app="DATALAKE",database="d_ambari_dpgbdhadoop",region="DEV"} 2021-03-11 19:13:28,467 - DEBUG - query-exporter - updating metric "query_latency" observe 0.001426246017217636 {app="DATALAKE",database="d_ambari_dpgbdhadoop",query="query1",region="D 2021-03-11 19:13:28,467 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="DATALAKE",database="d_ambari_dpgbdhadoop",query="query1",region="DEV",status="success"} 2021-03-11 19:13:28,469 - DEBUG - query-exporter - disconnected from database "postgres_slre7900302" 2021-03-11 19:13:28,469 - DEBUG - query-exporter - updating metric "metric1" set 3.26952180639946e-16 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",region="MAQUETTE"} 2021-03-11 19:13:28,469 - DEBUG - query-exporter - updating metric "query_latency" observe 0.003657922148704529 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",query="query1",r 2021-03-11 19:13:28,469 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",query="query1",region="MAQUETTE",status="succ 2021-03-11 19:13:48,473 - DEBUG - query-exporter - connected to database "d_ambari_dpgbdhadoop" 2021-03-11 19:13:48,473 - DEBUG - query-exporter - running query "query1" on database "d_ambari_dpgbdhadoop" 2021-03-11 19:13:48,473 - DEBUG - query-exporter - connected to database "postgres_sl101712" 2021-03-11 19:13:48,473 - DEBUG - query-exporter - running query "query1" on database "postgres_sl101712" 2021-03-11 19:13:48,475 - DEBUG - query-exporter - connected to database "postgres_slre7900302" 2021-03-11 19:13:48,475 - DEBUG - query-exporter - running query "query1" on database "postgres_slre7900302" 2021-03-11 19:13:48,477 - DEBUG - query-exporter - disconnected from database "d_ambari_dpgbdhadoop" 2021-03-11 19:13:48,478 - DEBUG - query-exporter - updating metric "metric1" set 4.29883875418454e-16 {app="DATALAKE",database="d_ambari_dpgbdhadoop",region="DEV"} 2021-03-11 19:13:48,478 - DEBUG - query-exporter - updating metric "query_latency" observe 0.0010924451053142548 {app="DATALAKE",database="d_ambari_dpgbdhadoop",query="query1",region=" 2021-03-11 19:13:48,478 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="DATALAKE",database="d_ambari_dpgbdhadoop",query="query1",region="DEV",status="success"} 2021-03-11 19:13:48,478 - DEBUG - query-exporter - disconnected from database "postgres_sl101712" 2021-03-11 19:13:48,478 - DEBUG - query-exporter - updating metric "metric1" set 2.4340254693845154e-16 {app="PN IARD",database="postgres_sl101712",region="DEV"} 2021-03-11 19:13:48,478 - DEBUG - query-exporter - updating metric "query_latency" observe 0.0011258013546466827 {app="PN IARD",database="postgres_sl101712",query="query1",region="DEV" 2021-03-11 19:13:48,478 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="PN IARD",database="postgres_sl101712",query="query1",region="DEV",status="success"} 2021-03-11 19:13:48,480 - DEBUG - query-exporter - disconnected from database "postgres_slre7900302" 2021-03-11 19:13:48,480 - DEBUG - query-exporter - updating metric "metric1" set 2.8986651065050496e-16 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",region="MAQUETTE"} 2021-03-11 19:13:48,480 - DEBUG - query-exporter - updating metric "query_latency" observe 0.003119003027677536 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",query="query1",r 2021-03-11 19:13:48,480 - DEBUG - query-exporter - updating metric "queries" inc 1 {app="ADMIN POSTGRESQL",database="postgres_slre7900302",query="query1",region="MAQUETTE",status="succ
Unfortunately, the deconnection doesn't happen:
[root@sl101712 ~]# date; ps -fu postgres |grep 172.23.246.38; date Thu Mar 11 19:13:55 CET 2021 postgres 113187 2955 0 19:12 ? 00:00:00 postgres: main: postgres postgres 172.23.246.38(34542) idle Thu Mar 11 19:13:55 CET 2021
uhm, that last ps
only shows the postgres user connected to the postgres db. That's not the exporter?
Pid 113187 is a postgres process session on sl101712 coming from client 172.23.246.38
On sl101712, process 113187 appears once I launched the query_exporter on 172.23.246.38
On sl101712, process 113187 disappears once I stopped the query_exporter on 172.23.246.38
Process 113187 is not exporter. It is a process session.
Describe the bug
I need to disconnect from postgresql instances after each query. I specified the option "keep-connected: false" in my config.yaml on master server but the option seems to be ineffective. For example, target_host=sl101712 , I can see process pid=105708 keep running for ever
Installation details
pip list
]To Reproduce
If possible, please provide detailed steps to reproduce the behavior: edit config.yaml for postgresql as mine run query-exporter check process of one postgres instance target ( you can filter with ip adress ) ps -fu postgres |grep
Or check postgresql.log of postgres instance target
metrics: metric1: type: gauge description: A sample gauge metric2: type: summary description: A sample summary labels: [l1, l2] metric3: type: histogram description: A sample histogram buckets: [10, 20, 50, 100, 1000] metric4: type: enum description: A sample enum states: [foo, bar, baz]
queries: query1: interval: 20 databases: [postgres_mpgbdpatroniexporter,d_ambari_dpgbdhadoop,postgres_sl101712,postgres_slre7900302] metrics: [metric1] sql: SELECT random() / 1000000000000000 AS metric1
query2:
interval: 20
timeout: 0.5
databases: [db1, db2]
metrics: [metric2, metric3]
sql: |
SELECT abs(random() / 1000000000000000) AS metric2,
abs(random() / 10000000000000000) AS metric3,
"value1" AS l1,
"value2" AS l2
query3:
schedule: "/5 *"
databases: [db2]
metrics: [metric4]
sql: |
SELECT value FROM (
SELECT "foo" AS metric4 UNION
SELECT "bar" AS metric3 UNION
SELECT "baz" AS metric4
)
ORDER BY random()
LIMIT 1
On target_host=sl101712, in postgresql.log, I can see there is no disconnection ( IP address of master=172.23.246.38)