Commit 8531aba
authored
User defined configuration to run the query for different database server version from single yml file (prometheus-community#428)
* Run the query for specific database version if provided from yml file.
By default query will run on all the databases if "runonserver" is not provided.
If user want the query to be run on multiple database versions, use below string.
runonserver: "9.5, 9.6"
Example yml file as below. ( e.g. below query will run only on database version 9.5 )
pg_replication:
query: "SELECT EXTRACT(EPOCH FROM (now() - pg_last_xact_replay_timestamp())) as lag"
master: true
runonserver: "9.5"
metrics:
- lag:
usage: "GAUGE"
description: "Replication lag behind master in seconds"
* Fixed the below review comments given by Ashesh Vashi
Instead of having db version string from yml file, user can define the range of
database server version where query is to be executed.
If user want to run the query on database version greater than 10.0.0, use below format.
runonserver: ">=10.0.0"
Below are the example of db version range user can defined in yml file.
<=10.1.0
>=12.1.0
=11.0.0
<9.6.0 || >=11.0.0
* Remove the call from unused places where 'runOnServer' is not required.
Only Server type hold that value.
* Fix compilation issues.
* Fix the issue with Debugln to print the database server version1 parent 301976c commit 8531aba
1 file changed
+15
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| |||
922 | 923 | | |
923 | 924 | | |
924 | 925 | | |
925 | | - | |
926 | | - | |
927 | | - | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
928 | 930 | | |
929 | 931 | | |
930 | 932 | | |
| |||
1449 | 1451 | | |
1450 | 1452 | | |
1451 | 1453 | | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
1452 | 1464 | | |
1453 | 1465 | | |
1454 | 1466 | | |
| |||
0 commit comments