influxdata / influxdata/telegraf

postgresql_extensible: max_idle and max_open params should not be freely configurable

Open
#13,818 4 comments 0 reactions 0 assignees View on GitHub
feature request
Dominant language
Go
Stars
17.8k
Forks
5.8k
Avg merge
1d 20h
Merged PRs (30d)
161

Description

### Use Case

Both `postgresql_extensible` and `postgresql` ever only use one connection at the time, for that reason narrow subset of all possible values of `max_idle` and `max_open` make sense.

## max_idle

`max_idle` configures how many connections to keep around in the pool between Gather. Only valid choices are `0` and `1` . When `0` Telegraf will establish connection every Gather, when `1` it will keep it around and reuse.

## max_open

`max_open` sets how many open connections there can be. Given that there is only one connection in use, this config option should be present as only sensible value is `1`.

### Expected behavior

Given the narrow range of possible values for these parameters, I think it makes sense to either clamp them or deprecate and replace with:

- `max_idle int` -> `reuse_connection bool`
- `max_open` -> remove entirely and ignore value if set.

### Actual behavior

presence of these params give false impression that they influence anything, but in fact they are mostly not.

### Additional info

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating the configuration entry points for the postgresql_extensible and postgresql plugins and trace how max_idle and max_open are applied. Resolve whether the change should clamp the existing parameters or replace them, then verify that the chosen behavior prevents unsupported connection-pool settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.