Skip to content

Commit 4d41f89

Browse files
authored
Merge pull request #685 from sysadmind/pg-stat-database
Convert pg_stat_database to new collector model
2 parents fe960c6 + 73b0b42 commit 4d41f89

File tree

2 files changed

+432
-25
lines changed

2 files changed

+432
-25
lines changed

cmd/postgres_exporter/postgres_exporter.go

-25
Original file line numberDiff line numberDiff line change
@@ -163,31 +163,6 @@ func dumpMaps() {
163163
}
164164

165165
var builtinMetricMaps = map[string]intermediateMetricMap{
166-
"pg_stat_database": {
167-
map[string]ColumnMapping{
168-
"datid": {LABEL, "OID of a database", nil, nil},
169-
"datname": {LABEL, "Name of this database", nil, nil},
170-
"numbackends": {GAUGE, "Number of backends currently connected to this database. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset.", nil, nil},
171-
"xact_commit": {COUNTER, "Number of transactions in this database that have been committed", nil, nil},
172-
"xact_rollback": {COUNTER, "Number of transactions in this database that have been rolled back", nil, nil},
173-
"blks_read": {COUNTER, "Number of disk blocks read in this database", nil, nil},
174-
"blks_hit": {COUNTER, "Number of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the PostgreSQL buffer cache, not the operating system's file system cache)", nil, nil},
175-
"tup_returned": {COUNTER, "Number of rows returned by queries in this database", nil, nil},
176-
"tup_fetched": {COUNTER, "Number of rows fetched by queries in this database", nil, nil},
177-
"tup_inserted": {COUNTER, "Number of rows inserted by queries in this database", nil, nil},
178-
"tup_updated": {COUNTER, "Number of rows updated by queries in this database", nil, nil},
179-
"tup_deleted": {COUNTER, "Number of rows deleted by queries in this database", nil, nil},
180-
"conflicts": {COUNTER, "Number of queries canceled due to conflicts with recovery in this database. (Conflicts occur only on standby servers; see pg_stat_database_conflicts for details.)", nil, nil},
181-
"temp_files": {COUNTER, "Number of temporary files created by queries in this database. All temporary files are counted, regardless of why the temporary file was created (e.g., sorting or hashing), and regardless of the log_temp_files setting.", nil, nil},
182-
"temp_bytes": {COUNTER, "Total amount of data written to temporary files by queries in this database. All temporary files are counted, regardless of why the temporary file was created, and regardless of the log_temp_files setting.", nil, nil},
183-
"deadlocks": {COUNTER, "Number of deadlocks detected in this database", nil, nil},
184-
"blk_read_time": {COUNTER, "Time spent reading data file blocks by backends in this database, in milliseconds", nil, nil},
185-
"blk_write_time": {COUNTER, "Time spent writing data file blocks by backends in this database, in milliseconds", nil, nil},
186-
"stats_reset": {COUNTER, "Time at which these statistics were last reset", nil, nil},
187-
},
188-
true,
189-
0,
190-
},
191166
"pg_stat_database_conflicts": {
192167
map[string]ColumnMapping{
193168
"datid": {LABEL, "OID of a database", nil, nil},

0 commit comments

Comments
 (0)