Joe Adams
4e521d460e
Fix bugs mentioned in #908 ( #910 )
...
* Fix bugs mentioned in #908
These collectors are disabled by default, so unless enabled, they are not tested regularly.
Signed-off-by: Joe Adams <github@joeadams.io >
---------
Signed-off-by: Joe Adams <github@joeadams.io >
2023-09-13 09:19:21 -04:00
David Cook
31ef4ed5a2
stat_user_tables: Add total size metric ( #904 )
...
Signed-off-by: David Cook <dcook@divviup.org >
2023-09-12 09:07:36 -04:00
Vladimir Luksha
0b6d9860ab
fix pg_replication_lag_seconds ( #895 )
...
Signed-off-by: Vladimir Luksha <waldemarluksha@gmail.com >
Co-authored-by: Vladimir Luksha <luksha@limcore.io >
2023-09-08 16:20:19 -04:00
Christian Albrecht
68ea167866
Fix a connection leak ( #902 )
...
The leak was introduced in PR#882
Signed-off-by: Christian Albrecht <cal@albix.de >
Co-authored-by: Christian Albrecht <christian.albrecht@akquinet.de >
2023-09-05 22:07:37 -04:00
Felix Yuan
5890879126
Gitlab Collector: Long running transactions collector and test ( #836 )
...
* Long running transactions collector and test
---------
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
Co-authored-by: Ben Kochie <superq@gmail.com >
2023-08-25 11:20:10 +02:00
Felix Yuan
ce74daee92
Gitlab Collector: User Index io stats collector and test ( #845 )
...
* User Index io stats collector and test
---------
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
2023-08-24 09:55:26 +02:00
Felix Yuan
2402783205
Bugfix: Make statsreset nullable ( #877 )
...
* Stats_reset as null seems to actually be legitimate for new databases,
so don't fail for it
---------
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
Co-authored-by: Ben Kochie <superq@gmail.com >
2023-08-24 09:51:26 +02:00
Joe Adams
b74852a535
Delay database connection until scrape ( #882 )
...
This no longer returns an error when creating a collector.instance when the database cannot be reached for the version query. This will resolve the entire postgresCollector not being registered for metrics collection when a database is not available. If the version query fails, the scrape will fail.
Resolves #880
Signed-off-by: Joe Adams <github@joeadams.io >
2023-08-23 17:33:47 -04:00
Ben Kochie
716ac23f20
Fixup new pg_stats_statements query ( #876 )
...
Fix all renames of `total_time` to `total_exec_time`.
Fixes: https://github.com/prometheus-community/postgres_exporter/issues/502
Signed-off-by: SuperQ <superq@gmail.com >
2023-07-25 22:36:51 +02:00
Ben Kochie
f9277b04b7
Handle new pg_stat_statements column names ( #874 )
...
Update pg_stat_statements collector to handle the new column names in
PostgreSQL 13.
Fixes: https://github.com/prometheus-community/postgres_exporter/issues/502
Signed-off-by: SuperQ <superq@gmail.com >
2023-07-25 16:20:37 +02:00
Felix Yuan
74800f483a
Gitlab collector: Xlog location collector and test ( #849 )
...
* Xlog location collector and test
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Add more escapes
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Change to Gauge
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
---------
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
2023-07-21 14:42:43 -04:00
Felix Yuan
2d7e152751
Gitlab Collector: Wal Receiver Collector and Test ( #844 )
...
* Wal Receiver Collector and Test
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Add more escapes
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Corrections to wal_receiver
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Continue on null labels
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Skip nulls and log a message
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Redundant breaks
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Fix up walreceiver
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Remove extra label
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Update collector/pg_stat_walreceiver.go
Co-authored-by: Ben Kochie <superq@gmail.com >
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Clean up the extra assignments
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Update collector/pg_stat_walreceiver.go
Co-authored-by: Joe Adams <github@joeadams.io >
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
---------
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
Co-authored-by: Ben Kochie <superq@gmail.com >
Co-authored-by: Joe Adams <github@joeadams.io >
2023-07-21 14:42:08 -04:00
Felix Yuan
dc3e813f43
Gitlab Collector: Autovacuum collector and test ( #840 )
...
* Autovacuum collector and test
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Update collector/pg_stat_activity_autovacuum.go
Co-authored-by: Joe Adams <github@joeadams.io >
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Update collector/pg_stat_activity_autovacuum.go
Co-authored-by: Joe Adams <github@joeadams.io >
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Use timestamp seconds
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* query formating
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* SQL format
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
* Loosen autovacuum query
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
---------
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
Co-authored-by: Joe Adams <github@joeadams.io >
2023-07-21 14:41:25 -04:00
Felix Yuan
12c12cf368
Add a logger to stat_database collector to get better handle on error
...
(also clean up some metric validity checks)
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
2023-07-19 14:26:41 -07:00
Felix Yuan
4aa8cd4996
Gitlab collector: Database wraparound collector and test ( #834 )
...
* Database wraparound collector and test
---------
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
Co-authored-by: Joe Adams <github@joeadams.io >
2023-07-14 22:42:12 +02:00
Joe Adams
4ac5481917
Merge pull request #862 from tomhughes/idle-state
...
Include all idle processes in the process idle metrics
2023-07-06 19:58:39 -04:00
Ben Kochie
5f917ccdd9
Improve linting ( #861 )
...
* Disable unused-parameter check due to false positives on Collect()
calls.
* Enable misspell.
* Simplify error returns.
Signed-off-by: SuperQ <superq@gmail.com >
2023-07-06 13:08:45 +02:00
Tom Hughes
a8b86cf7da
Include all idle processes in the process idle metrics
...
Signed-off-by: Tom Hughes <tom@compton.nu >
2023-07-06 08:48:59 +01:00
Tom Hughes
6b56e2f057
Unpack postgres arrays for process idle times correctly ( #855 )
...
Signed-off-by: Ben Kochie <superq@gmail.com >
2023-07-06 09:33:54 +02:00
Daniel Swarbrick
2477aba363
Fix untyped integer overflows on 32-bit archs ( #857 )
...
go-sqlmock's Rows.AddRow() takes values which have a type alias of
"any", and appear to default to untyped ints if not explicitly cast.
When large values are passed which would overflow int32, tests fail.
Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com >
2023-07-05 15:10:47 +02:00
Tom Hughes
2ca1798188
Add a collector to gather metrics on WAL size
...
Signed-off-by: Tom Hughes <tom@compton.nu >
2023-07-05 11:51:57 +01:00
Tom Hughes
099d3ddb6f
Add some more escapes to the query sanitizer
...
Signed-off-by: Tom Hughes <tom@compton.nu >
2023-07-04 19:08:35 +01:00
Tom Hughes
d920553227
Fix replication collector
...
Signed-off-by: Tom Hughes <tom@compton.nu >
2023-07-03 17:51:50 +01:00
Felix Yuan
e6ce2ecba9
Bug Fix: Fix lingering type issues ( #828 )
...
* Fix postmaster type issue
* Disable postmaster collector by default
---------
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
2023-06-27 20:18:02 +02:00
Ben Kochie
030a2a9bc7
Cleanup collectors ( #826 )
...
Fix up `replication` and `process_idle` Update input params to match
the rest of the collectors.
Signed-off-by: SuperQ <superq@gmail.com >
2023-06-27 16:40:12 +02:00
Ben Kochie
1a4e8993f6
Migrate pg_locks to collector package ( #817 )
...
Migrate the `pg_locks_count` query from `main` to the `collector`
package.
Signed-off-by: SuperQ <superq@gmail.com >
2023-06-27 15:59:30 +02:00
Vadim Voitenko
6a1bb59efb
Fixed replication pgReplicationSlotQuery - now it's working correctly for replica and primary ( #825 )
...
Signed-off-by: Vadim Voitenko <vadim.voitenko@exness.com >
Co-authored-by: Vadim Voitenko <vadim.voitenko@exness.com >
2023-06-27 15:47:33 +02:00
Felix Yuan
8d087f2c64
Bug fix: Make collector not fail on null values ( #823 )
...
* Make all values nullable
---------
Signed-off-by: Felix Yuan <felix.yuan@reddit.com >
Co-authored-by: Ben Kochie <superq@gmail.com >
2023-06-27 08:07:59 +02:00
Joe Adams
ab33346cbd
Add the instance struct to handle connections
...
The intent is to use the instance struct to hold the connection to the database as well as metadata about the instance. Currently this metadata only includes the version of postgres for the instance which can be used in the collectors to decide what query to run. In the future this could hold more metadata but for now it keeps the Collector interface arguments to a reasonable number.
Signed-off-by: Joe Adams <github@joeadams.io >
2023-06-21 20:36:59 -04:00
Ben Kochie
99828de70a
Fix up collector registration ( #812 )
...
Use const definitions to make collector registration consistent.
* Use collector subsystem name consistently.
* Fix up replication metric name unit.
Signed-off-by: SuperQ <superq@gmail.com >
2023-06-13 17:28:11 +02:00
Joe Adams
fe486012c9
Fix pg_stat_database collector
...
The signature for creating a collector changed and CI didn't retrigger. Move metrics out of map and into individual vars.
Signed-off-by: Joe Adams <github@joeadams.io >
2023-06-12 19:48:28 -04:00
Joe Adams
4d41f89f0c
Merge pull request #685 from sysadmind/pg-stat-database
...
Convert pg_stat_database to new collector model
2023-06-12 19:25:46 -04:00
Felix Yuan
fe960c6b54
Move queries from queries.yaml to collectors ( #801 )
...
Signed-off-by: Ben Kochie <superq@gmail.com >
2023-06-08 23:28:04 +02:00
SuperQ
fab8e625a8
Update linting
...
* Move errcheck exclude list to config file.
* Enable revive linter
* Fix up revive linting issues.
Signed-off-by: SuperQ <superq@gmail.com >
2023-06-03 09:28:17 +02:00
SuperQ
425c4938ef
Refactor collector descriptors
...
Use individual collector metric descriptor vars to help avoid
miss-mapped or unused metrics.
Signed-off-by: SuperQ <superq@gmail.com >
2023-06-01 10:04:35 +02:00
Joe Adams
1e3b177e34
Fix column type for pg_replication_slots
...
Change the data type of `active` from int64 to bool. The documentation confirms that this is a boolean field.
https://www.postgresql.org/docs/current/view-pg-replication-slots.html
fixes #769
Signed-off-by: Joe Adams <github@joeadams.io >
2023-03-22 20:54:00 -04:00
SuperQ
de1c3cc5e7
Update exporter-toolkit
...
Updates the exporter-toolkit to the latest version
* Adds new landing page feature.
* Allow metrics path to be on `/`.
Signed-off-by: SuperQ <superq@gmail.com >
2023-03-21 08:23:23 +01:00
Joe Adams
8d6ce0558c
Remove commented code
...
Signed-off-by: Joe Adams <github@joeadams.io >
2023-03-05 15:18:23 -05:00
Joe Adams
799f3e15b2
Fix exclude-databases for collector package
...
The pg_database collector was not respecting the --exclude-databases flag and causing problems where databases were not accessible. This now respects the list of databases to exclude.
- Adjusts the Collector create func to take a config struct instead of a logger. This allows more changes like this in the future. I figured we would need to do this at some point but I wasn't sure if we could hold off.
- Split the database size collection to a separate query when database is not excluded.
- Comment some probe code that was not useful/accurate
Signed-off-by: Joe Adams <github@joeadams.io >
2023-03-05 15:13:00 -05:00
Joe Adams
94a89b0166
Merge pull request #734 from kjbass/master
...
Close DB connection after probe completes.
2023-02-12 14:52:50 -05:00
Zachary Caldarola
076eb2c3f5
fmt
...
Signed-off-by: Zachary Caldarola <zmc2005@gmail.com >
2023-01-28 18:45:48 -05:00
Zachary Caldarola
f3952f941b
typing
...
Signed-off-by: Zachary Caldarola <zmc2005@gmail.com >
2023-01-28 17:40:46 -05:00
Zachary Caldarola
1ec69c9168
fmt
...
Signed-off-by: Zachary Caldarola <zmc2005@gmail.com >
2023-01-28 17:37:41 -05:00
Zachary Caldarola
600ad185cf
more comments
...
Signed-off-by: Zachary Caldarola <zmc2005@gmail.com >
2023-01-28 17:05:45 -05:00
Zachary Caldarola
9b13780d14
addressing comments
...
Signed-off-by: Zachary Caldarola <zachary.caldarola@reddit.com >
2023-01-25 11:15:24 -05:00
Zachary Caldarola
300750001c
adding codified functionality for logical replication metrics
...
Signed-off-by: Zachary Caldarola <zachary.caldarola@reddit.com >
2023-01-24 14:52:00 -05:00
Kurtis Bass
76223cdda8
probe: clean-up database connection after probe to prevent connection leak
...
Signed-off-by: Kurtis Bass <kurtis.bass@hinge.co >
2022-12-14 14:30:13 -05:00
Joe Adams
73b0b42c8d
Convert pg_stat_database to new collector model
...
Signed-off-by: Joe Adams <github@joeadams.io >
2022-09-02 12:24:25 -04:00
Joe Adams
7ffba684de
Update multi-target handler to use new DSN type
...
- Moves new dsn type to config.DSN. This will prevent circular dependencies.
- Change DSN.query to be url.Values. This allows the multi-target functionality to merge values without re-parsing the query string
- Change NewProbeCollector to use the new config.DSN type
- Add DSN.GetConnectionString to return a string formatted for the sql driver to use during connection
Signed-off-by: Joe Adams <github@joeadams.io >
2022-09-02 10:32:44 -04:00
Nicolas Rodriguez
8855b7a604
Fix checkpoint_sync_time value type
...
Error:
sql: Scan error on column index 3, name \"checkpoint_sync_time\": converting driver.Value type float64 (\"1.876469e+06\") to a int: invalid syntax
See also:
https://github.com/prometheus-community/postgres_exporter/issues/633
https://github.com/prometheus-community/postgres_exporter/pull/666
Signed-off-by: Nicolas Rodriguez <nico@nicoladmin.fr >
2022-07-30 17:11:11 +02:00