Skip to content

Commit

Permalink
Collect pg_settings.pending_restart.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevan committed Oct 2, 2021
1 parent 1773a01 commit 186b479
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions collector/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,8 @@ func (c *collector) getSettings() {
defer cancel()

q := `SELECT name, setting, COALESCE(boot_val,''), source,
COALESCE(sourcefile,''), COALESCE(sourceline,0)
COALESCE(sourcefile,''), COALESCE(sourceline,0),
pending_restart
FROM pg_settings
ORDER BY name ASC`
rows, err := c.db.QueryContext(ctx, q)
Expand All @@ -592,7 +593,7 @@ func (c *collector) getSettings() {
for rows.Next() {
var s pgmetrics.Setting
var name, sf, sl string
if err := rows.Scan(&name, &s.Setting, &s.BootVal, &s.Source, &sf, &sl); err != nil {
if err := rows.Scan(&name, &s.Setting, &s.BootVal, &s.Source, &sf, &sl, &s.Pending); err != nil {
log.Fatalf("pg_settings query failed: %v", err)
}
if len(sf) > 0 {
Expand Down
2 changes: 2 additions & 0 deletions model.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ type Setting struct {
Setting string `json:"setting"`
BootVal string `json:"bootval,omitempty"`
Source string `json:"source,omitempty"`
// following fields present only in schema 1.11 and later
Pending bool `json:"pending,omitempty"`
}

type WALArchiving struct {
Expand Down

0 comments on commit 186b479

Please sign in to comment.