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
bravosierrasierra
a627e7fce7
fix for exporter issue 633
...
fix for exporter issue 633: https://github.com/prometheus-community/postgres_exporter/issues/633
"Scan error on column index 2, name \"checkpoint_write_time\": converting driver.Value type float64 (\"6.594096e+06\") to a int: invalid syntax #633 "
Signed-off-by: bravosierrasierra <bravosierrasierra@users.noreply.github.com >
2022-07-29 13:33:23 +03:00
Joe Adams
713461df98
WIP: Add prelim multi-target support
...
- Remove multi server support from new collector package
- Add http handler for multi-target support
Signed-off-by: Joe Adams <github@joeadams.io >
2022-07-28 10:19:32 -04:00
Joe Adams
9704b9fb2e
Clean up autoDiscoverDatabases in the new collector
...
Signed-off-by: Joe Adams <github@joeadams.io >
2022-02-25 08:11:22 -05:00
Joe Adams
27d23d02ef
refactor pg_stat_bgwriter metrics into standalone collector
...
This moves the metrics that are queried from pg_stat_bgwriter into a dedicated collector instead of dynamically generating queries and metrics from a map. It renames some metrics including adding the `_total` suffix on all of the counters to match prometheus standards. This implementation uses QueryRowContext to allow for later addition of context for cancellation. From the Postgres documentation, it states that there is one line per WAL sender process, but it is unclear how to differentiate between them in any meaningful way. When querying the table, there is no column to identify the row, only metrics about bgwriter.
Signed-off-by: Joe Adams <github@joeadams.io >
2022-02-22 21:46:43 -05:00
Joe Adams
9dad33c397
Comment unused var
...
Signed-off-by: Joe Adams <github@joeadams.io >
2022-02-14 21:14:17 -05:00
Joe Adams
c3b0206369
Add collector interface
...
Uses node_exporter style collector registration
Signed-off-by: Joe Adams <github@joeadams.io >
2022-02-14 21:12:27 -05:00
Joe Adams
1981623d9d
Add missing server label
...
Signed-off-by: Joe Adams <github@joeadams.io >
2022-02-09 21:56:48 -05:00
Joe Adams
21a19ed252
Add pg_database collector
...
Converts the pg_database metrics from queries.yaml to a built in collector. This is enabled by default because it is not likely to be a performance problem and likely very useful data.
Signed-off-by: Joe Adams <github@joeadams.io >
2022-02-09 21:28:40 -05:00