pgsty / pgsty/pg_exporter

Add option to test selected metric(s) and also options to select metric(s) to test, explain and configuration dump

Open
#27 1 comment 0 reactions 1 assignee View on GitHub

@Vonng is already working on this.

Since Jun 4, 2022.

enhancement
Dominant language
Go
Stars
363
Forks
59
PR merge metrics
No merged PRs in 30d

Description

Hello. I suggest to add

Flags
       [...]

       --test
           Testing run (single pass run returning collected '/metrics' to the standard output to be revised).
           To limit the test run to a certain list of metrics use the '-M' option.

       -M, --metrics LIST
           Limit testing run (see the '--test' option) to a list of comma (',') separated metric names.
           Only the SQL queries of the selected metrics will be run (eg. '--test --metrics pg_up,pg_uptime'
           will run the SQL queries of the 'pg_up' and 'pg_uptime' metrics).

       [...]

I also suggest to apply --metrics LIST to --explain similarly, if possible.

The --dry-run option should not produce any output instead of eg. warnings or errors etc. In fact, it must not even try to perform the connection to the Postgres etc. Therefor it's "dry run" (!) and everybody expects that it does literally nothing, no real action (which connection certainly is).

To dump the actual configuration I suggest to provide another option, say --show-config, --dump-config or --format-config or similar and to apply --metrics LIST to it as well.

That way you could easily

  1. see what's configured for certain metric (eg. --show-config -M pg_up);
  2. check if there is no error or discrepancy in the configuration (eg. --dry-run);
  3. test the metric of interest (eg. --test -M pg_up).

The exporter should return proper exit codes so that these features could be used in scripts etc.

Whether to provide also environment variables for the suggested options remains a question. I generally do not see any point in not doing so (it could be good for container users who tend to use environment variables).


I think all these things are somewhat related one to each other so I aggregated them in this single feature request, sorry for that.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.