Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mjf opened this issue Jun 1, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@mjf
Copy link
Contributor

mjf commented Jun 1, 2022

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.

@mjf mjf changed the title Add option to test metrics and options to limit metrics used for tests, explains and configuration dumps Add option to test selected metric(s) and also options to select metric(s) used for test, explain and configuration dump Jun 1, 2022
@mjf mjf changed the title Add option to test selected metric(s) and also options to select metric(s) used for test, explain and configuration dump Add option to test selected metric(s) and also options to select metric(s) to test, explain and configuration dump Jun 1, 2022
@Vonng
Copy link
Owner

Vonng commented Jun 4, 2022

That would be a great feature for testing & introspection.
Maybe I could have some draft implementation in next release

@Vonng Vonng self-assigned this Jun 4, 2022
@Vonng Vonng added the enhancement New feature or request label Jun 4, 2022
@Vonng Vonng added this to the 0.6 milestone Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants