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

Commit 78ddb24

Browse files
committed
Run bloat queries with 1 hour interval
1 parent 0da9900 commit 78ddb24

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Diff for: gauges/indexes.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ type indexBloat struct {
253253
}
254254

255255
// IndexBloat returns bloat percentage of an index reporting only for indexes
256-
// with size greater than 10mb and bloat lower than 50%
256+
// with size greater than 10mb and bloat greater than 50%
257257
func (g *Gauges) IndexBloat() *prometheus.GaugeVec {
258258
var gauge = prometheus.NewGaugeVec(
259259
prometheus.GaugeOpts{
@@ -274,7 +274,7 @@ func (g *Gauges) IndexBloat() *prometheus.GaugeVec {
274274
}).Set(idx.Pct)
275275
}
276276
}
277-
time.Sleep(g.interval)
277+
time.Sleep(1 * time.Hour)
278278
}
279279
}()
280280
return gauge

Diff for: gauges/tables.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,13 @@ type tableBloat struct {
130130
Pct float64 `db:"pct_bloat"`
131131
}
132132

133+
// TableBloat returns the bloat percentage of a table reporting only for tables
134+
// with bloat percentange greater than 30% or greater than 1000mb
133135
func (g *Gauges) TableBloat() *prometheus.GaugeVec {
134136
var gauge = prometheus.NewGaugeVec(
135137
prometheus.GaugeOpts{
136138
Name: "postgresql_table_bloat_pct",
137-
Help: "bloat percentage of an index. Reports only for tables with a lot of bloat",
139+
Help: "bloat percentage of a table. Reports only for tables with a lot of bloat",
138140
ConstLabels: g.labels,
139141
},
140142
[]string{"table"},
@@ -149,7 +151,7 @@ func (g *Gauges) TableBloat() *prometheus.GaugeVec {
149151
}).Set(table.Pct)
150152
}
151153
}
152-
time.Sleep(g.interval)
154+
time.Sleep(1 * time.Hour)
153155
}
154156
}()
155157
return gauge

0 commit comments

Comments
 (0)