1
0
mirror of https://github.com/prometheus-community/postgres_exporter.git synced 2025-08-12 14:02:47 +03:00

Use the pg_settings view to retrieve runtime variable

Adds all bool/integer/real runtime variables that can be retrieved ths way.

Use the `pg_settings` view to retrieve runtime variables:
https://www.postgresql.org/docs/current/static/view-pg-settings.html

Replaces the use of `SHOW` to retrieve runtime variables.

Only runtime variables with a `vartype` of `bool`, `real`, or `integer`
are currently supported. Uses the `short_desc` field as a description.

This commit deprecates the following metric names:
```
pg_runtime_variable_max_connections
pg_runtime_variable_max_files_per_process
pg_runtime_variable_max_function_args
pg_runtime_variable_max_identifier_length
pg_runtime_variable_max_index_keys
pg_runtime_variable_max_locks_per_transaction
pg_runtime_variable_max_pred_locks_per_transaction
pg_runtime_variable_max_prepared_transactions
pg_runtime_variable_max_standby_archive_delay_milliseconds
pg_runtime_variable_max_standby_streaming_delay_milliseconds
pg_runtime_variable_max_wal_senders
```

They are replaced by equivalent names under `pg_settings` with the exception of
```
pg_runtime_variable_max_standby_archive_delay_milliseconds
pg_runtime_variable_max_standby_streaming_delay_milliseconds
```
which are replaced with
```
pg_settings_max_standby_archive_delay_seconds
pg_settings_max_standby_streaming_delay_seconds
```

Adds approximately 195 new metrics, when considered across all supported
PostgreSQL versions.
This commit is contained in:
Matt Bostock
2017-03-27 22:34:22 +01:00
committed by Will Rouesnel
parent 994be318d4
commit 98ba566322
4 changed files with 331 additions and 75 deletions

View File

@@ -13,6 +13,7 @@ import (
"database/sql"
"fmt"
_ "github.com/lib/pq"
"github.com/prometheus/client_golang/prometheus"
)
@@ -57,13 +58,10 @@ func (s *IntegrationSuite) TestAllNamespacesReturnResults(c *C) {
err = s.e.checkMapVersions(ch, db)
c.Assert(err, IsNil)
// Check the show variables work
nonFatalErrors := queryShowVariables(ch, db, s.e.variableMap)
if !c.Check(len(nonFatalErrors), Equals, 0) {
fmt.Println("## NONFATAL ERRORS FOUND")
for _, err := range nonFatalErrors {
fmt.Println(err)
}
err = querySettings(ch, db)
if !c.Check(err, Equals, nil) {
fmt.Println("## ERRORS FOUND")
fmt.Println(err)
}
// This should never happen in our test cases.