Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Run bloat queries with 1 hour interval
Browse files Browse the repository at this point in the history
  • Loading branch information
diogonicoleti committed Jan 14, 2019
1 parent 0da9900 commit 78ddb24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gauges/indexes.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ type indexBloat struct {
}

// IndexBloat returns bloat percentage of an index reporting only for indexes
// with size greater than 10mb and bloat lower than 50%
// with size greater than 10mb and bloat greater than 50%
func (g *Gauges) IndexBloat() *prometheus.GaugeVec {
var gauge = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Expand All @@ -274,7 +274,7 @@ func (g *Gauges) IndexBloat() *prometheus.GaugeVec {
}).Set(idx.Pct)
}
}
time.Sleep(g.interval)
time.Sleep(1 * time.Hour)
}
}()
return gauge
Expand Down
6 changes: 4 additions & 2 deletions gauges/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,13 @@ type tableBloat struct {
Pct float64 `db:"pct_bloat"`
}

// TableBloat returns the bloat percentage of a table reporting only for tables
// with bloat percentange greater than 30% or greater than 1000mb
func (g *Gauges) TableBloat() *prometheus.GaugeVec {
var gauge = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "postgresql_table_bloat_pct",
Help: "bloat percentage of an index. Reports only for tables with a lot of bloat",
Help: "bloat percentage of a table. Reports only for tables with a lot of bloat",
ConstLabels: g.labels,
},
[]string{"table"},
Expand All @@ -149,7 +151,7 @@ func (g *Gauges) TableBloat() *prometheus.GaugeVec {
}).Set(table.Pct)
}
}
time.Sleep(g.interval)
time.Sleep(1 * time.Hour)
}
}()
return gauge
Expand Down

0 comments on commit 78ddb24

Please sign in to comment.