You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let Telegraf make persistent connection to postgresql database
Proposal:
We are using telegraf to collect metric data from postgresql and it works well, however, we found that it doesn’t keep persistent connection postgresql, which causes unnecessary growth and noises in postgresql log file
Current behavior:
Telegraf makes connection to postgresql every INTERVAL seconds and then disconnects.
Desired behavior:
Telegraf shall make persistent connection to postgresql
Use case: [Why is this important (helps with prioritizing requests)]
Too many connections and disconnections cause growth and noises in postgresql log files which is unnecessary at all.
I'll probably tackle this soon (within the next couple weeks).
The way I think i'm going to do it is to add a pool_size_max = X parameter. If X is 0, the current behavior will be used (disconnect once done). Otherwise it'll connect up to X times, running the queries in parallel. To just have 1 long lived connection, it'd just be pool_size_max = 1.
@phemmer may I suggest we just specify the 3 values for a standard db connection?
IdleConns (default 1, can be set to 0 for disconnect after use) I think 1 is the more sensible default though it will change current default behaviour.
MaxOpenConns - (default 1)
ConnMaxLifetime - (default 0, keep the same connection forever do not cycle)
Feature Request
Let Telegraf make persistent connection to postgresql database
Proposal:
We are using telegraf to collect metric data from postgresql and it works well, however, we found that it doesn’t keep persistent connection postgresql, which causes unnecessary growth and noises in postgresql log file
Current behavior:
Telegraf makes connection to postgresql every INTERVAL seconds and then disconnects.
Desired behavior:
Telegraf shall make persistent connection to postgresql
Use case: [Why is this important (helps with prioritizing requests)]
Too many connections and disconnections cause growth and noises in postgresql log files which is unnecessary at all.
Log output:
< 2016-10-31 10:48:14.863 PDT >LOG: disconnection: session time: 0:00:00.014 user=telegraf database=postgres host=127.0.0.1 port=36218
< 2016-10-31 10:48:15.849 PDT >LOG: connection received: host=127.0.0.1 port=36220
< 2016-10-31 10:48:15.850 PDT >LOG: connection authorized: user=telegraf database=postgres
< 2016-10-31 10:48:15.863 PDT >LOG: disconnection: session time: 0:00:00.014 user=telegraf database=postgres host=127.0.0.1 port=36220
The text was updated successfully, but these errors were encountered: