influxdata / influxdata/telegraf

postgresql_extensible: include queries from the file

Open
#13,770 11 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

When configuring multiple instances of `postgresql_extensible` plugin with same set of queries for each, queries end up taking majority of space of the resulting config.toml. When Telegraf config comes from Kubernetes ConfigMap there is a hard limit on the object size (1MB-3MB, depending on the setup), which is very easy to reach because of queries repetition.

Adding `queries_file` param which expects TOML file as if it was specified inline will help not reaching size limits on the config file.

### Expected behavior

When given following config:

```
[[inputs.postgres_extensible]]
address = "..."
queries_file = "queries.toml"
```

with `queries.toml` content:

```
[[inputs.postgres_extensible.query]]
sqlquery = "SELECT 1"

[[inputs.postgres_extensible.query]]
sqlquery = "SELECT 2"
```

Should have same result as specifying all inline like following:

```
[[inputs.postgres_extensible]]
address = "..."

[[inputs.postgres_extensible.query]]
sqlquery = "SELECT 1"

[[inputs.postgres_extensible.query]]
sqlquery = "SELECT 2"
```

### Actual behavior

All queries must be specified inline and therefore duplicated for each plugin instance

### Additional info

It might be use-case to have generic `include_config` option available when specifying configuration for any plugin or maybe even anywhere in the whole TOML file, uncluding other sections like `[agent]` and `[global_tags]`

Contributor guide

Open the contributing guide

Research direction

Start by locating the postgresql_extensible plugin and its configuration handling, then inspect how inline query entries are read. Use the queries.toml and config.toml examples as the comparison case, and verify that queries_file produces the same result as equivalent inline queries.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.