Commit Graph

129 Commits

Author SHA1 Message Date
Will Rouesnel
61b93a17a6 Fix a pervasive misnaming of "this" to "cu".
At some point in the past we find/replaced "this" to "cu" in the source code
and it's been like that ever since, including leaking into some of the metric
descriptions. Clean it up.
2017-11-29 23:36:53 +11:00
Will Rouesnel
f4bf817f25 Rename the last_scrape_connection_error metric to up.
On advice from @SuperQ this is inline with the convention used in similar
exporters (example being the mysqld exporter). The full metric name is thus
`pg_up`.

Closes #135
2017-11-29 23:14:12 +11:00
Will Rouesnel
6802f4bbe3 Add test cases for unknown metric parsing. 2017-11-29 12:19:16 +10:00
Will Rouesnel
df3a71eb79 Add last_scrape_connection_error metric.
This metric is only set to 0 after the database has been connected to and a
Ping() request via the pg driver has been successfully sent.

Closes #135.
2017-11-29 12:19:16 +10:00
Will Rouesnel
93f9646385 Add metric for user queries YAML file.
Adds a status metric to indicate that the user queries YAML file loaded
successfully. Also adds the file path and hashsum as labels.

Closes #125
2017-11-29 12:19:16 +10:00
Will Rouesnel
214ce477d0 Fix panic due to inconsistent label cardinality when using queries.yaml.
When using queries.yaml, extra columns in the output would be detected as
unknown metrics (correctly) but the labels in the current mapping would not be
applied to the output.

This explains the rash of crashes due to inconsistent label cardinality. The
specific creation is when the name given to a column does not match the mapping
you intended, and so the metric shows up as unknown.

Closes #98
2017-11-29 12:19:16 +10:00
Никита Конев (home Fedora)
de30c017f4 fix invisibility of "/metrics" 2017-11-27 13:28:10 +10:00
Chris Travers
8b4d70ae5f Removed unnecessary complexity in readme.md
In PostgreSQL, views run as the defining user, meaning you don't 
need a view wrapping a function (you can just have a view).  This 
improves readability, maintainability, performance, and clarity.
2017-10-26 20:01:59 +11:00
rp
0e9fccdb27 add rc-script for postgres_exporter 2017-10-26 19:46:51 +11:00
Will Rouesnel
e3dbbe64fd Update README.md 2017-10-26 19:46:02 +11:00
Will Rouesnel
0e4c3ce395 Update all dependencies.
* Switch to using kingpin for CLI interface as upstream Prometheus has moved
  that way too.
2017-10-26 19:27:29 +11:00
Will Rouesnel
5c04bc0463 Add support for attribute renames from Postgres 10. 2017-10-23 16:20:33 +11:00
Will Rouesnel
9026088d66 Remove localhost assumption for standalone tests. 2017-10-23 16:20:33 +11:00
Will Rouesnel
97708205f6 Fix regression where failed tests would still leave passing builds. 2017-10-23 16:20:33 +11:00
Will Rouesnel
2d3aa082b1 Add PostgreSQL 10 to smoke-tests.
Closes #111.
Closes #91.
2017-10-23 16:20:33 +11:00
Will Rouesnel
cb4b628ca1 Add tolerant version regex parsing to handle PostgreSQL 10.
Closes #112.
2017-10-23 16:20:33 +11:00
Matthias Berkenkamp
6e3d130f40 fix shell usage in make file 2017-09-20 21:24:32 +10:00
Matthias Berkenkamp
4bee618699 add coverage folder 2017-09-20 21:24:32 +10:00
Matthias Berkenkamp
5a4b1a5f81 try to fix coverage location in travis 2017-09-20 21:24:32 +10:00
Matthias Berkenkamp
142716dcb0 use check for tests 2017-09-20 21:24:32 +10:00
Matthias Berkenkamp
fce6b005a6 add some test cases 2017-09-20 21:24:32 +10:00
Matthias Berkenkamp
fcf07546cd Fix gofmt issues 2017-09-20 21:24:32 +10:00
Matthias Berkenkamp
528e347b48 add support for secrets files 2017-09-20 21:24:32 +10:00
Will Rouesnel
e701b80fd5 Add the 16kB unit size to pg_settings parser.
Fixes #101.
2017-09-07 23:52:27 +10:00
Will Rouesnel
17592ee8e9 Fix new linter errors. 2017-08-04 02:30:33 +10:00
Will Rouesnel
4c2dc4a7dd unparam was refusing to update - force an update. 2017-08-04 02:30:33 +10:00
Will Rouesnel
23f4af2354 Allow the redacted DSN logging to actually fire (DSN was never logged).
The DSN parsing code failed to ever detect a URL like DSN, and as such never
logged anything.
2017-08-04 02:30:33 +10:00
Will Rouesnel
c692b4e76a Localize the shared database connection to the Exporter object.
This allows the integration tests to properly exercise configuration parameters.
2017-08-04 02:30:33 +10:00
Will Rouesnel
41cb2e7a68 Add test case for issue #93. 2017-08-04 02:30:33 +10:00
Will Rouesnel
a7ff84a674 Update vendored tools/. 2017-08-04 02:30:33 +10:00
Giancarlo Rubio
1afbd62ab1 Sample for database size (#76) 2017-07-26 22:53:16 +10:00
Alexander Savchuk
81194c9219 Grant postgres_exporter role to deployer role
If the deployer role is not superuser (which is the case in AWS RDS,
for example), we need to grant it access to postgres_exporter role
before we can create a schema with AUTHORIZATION postgres_exporter.
2017-06-09 20:04:27 +10:00
Alexander Savchuk
1ec400b707 Fix PostgreSQL name
PostgreSQL name was misspelled in
53b9d9cea7.
2017-06-09 20:04:27 +10:00
Will Rouesnel
3b9a68897f Fix overbroad tools .gitignore. 2017-06-07 00:53:19 +10:00
Will Rouesnel
f5c88e1806 Update tools/Makefile. 2017-06-07 00:53:19 +10:00
Will Rouesnel
801793e185 Update .travis.yml. 2017-06-07 00:53:19 +10:00
Will Rouesnel
8877b69804 Fix an extraneous comma which bugged the SQL introduced when merging PR #78
See commit 0de0311c22. The SQL for <9.2 had a
typo which we somehow missed, caught by integration testing.
2017-06-07 00:53:19 +10:00
Will Rouesnel
3f0fb9d3a4 Suppress build messages from tools/Makefile 2017-06-07 00:53:19 +10:00
Will Rouesnel
8a1a12fd05 Update Makefile test handling. 2017-06-07 00:53:19 +10:00
Will Rouesnel
34ffcb449d Fix issues identified by the gometalinters. 2017-06-07 00:53:19 +10:00
Will Rouesnel
4477dfa9b3 Add warning if Postgres Version is lower then the minimum version. 2017-06-07 00:53:19 +10:00
Will Rouesnel
e2b6c973a1 Add self-contained gometalinter build tooling. 2017-06-07 00:53:19 +10:00
Guo Xiang Tan
0de0311c22 Ignore functions that cannot be executed during recovery.
https://github.com/wrouesnel/postgres_exporter/issues/52
2017-06-07 00:02:49 +10:00
Tyler Yahn
5c587cb725 Add CLI flag to return version info
Fixes wrouesnel/postgres_exporter#67.
2017-06-06 23:57:30 +10:00
Heikki Hulkko
1bf7f2435f Add confirmed_flush_lsn to pg_stat_replication 2017-06-06 23:51:34 +10:00
Adam Sunderland
1fa394d488 Remove pg_settings query examples
These fields are now automatically scraped so they will conflict if they are accidentally specified.
2017-04-24 00:01:39 -10:00
Will Rouesnel
c4f701e817 Fix the .travis.yml deployment. 2017-04-18 23:25:56 +10:00
Adam Sunderland
a87b6bc583 Handle pg_settings names with '.' 2017-04-18 23:11:14 +10:00
Matt Bostock
98ba566322 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.
2017-04-14 02:09:44 +10:00
Will Rouesnel
994be318d4 Add metric parsing scripts to generate additions/removals for complex changes.
These scripts hold some learnings on how to compare changes to the metric
profile of the exporter. In future we'll teach travis to build this against
master automatically and post a comment back to a PR with what's been changed.

For now we just want to store them.
2017-04-14 01:57:51 +10:00