Skip to content

Commit

Permalink
Add option to omit collection of index definitions.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevan committed Oct 9, 2021
1 parent 32b912c commit c6034e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cmd/pgmetrics/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Collection options:
--omit=WHAT do NOT collect the items specified as a comma-separated
list of: "tables", "indexes", "sequences",
"functions", "extensions", "triggers",
"statements", "log", "citus"
"statements", "log", "citus", "indexdefs"
--sql-length=LIMIT collect only first LIMIT characters of all SQL
queries (default: 500)
--statements-limit=LIMIT collect only utmost LIMIT number of row from
Expand Down Expand Up @@ -279,7 +279,8 @@ func (o *options) parse() (args []string) {
for _, om := range o.CollectConfig.Omit {
if om != "tables" && om != "indexes" && om != "sequences" &&
om != "functions" && om != "extensions" && om != "triggers" &&
om != "statements" && om != "log" && om != "citus" {
om != "statements" && om != "log" && om != "citus" &&
om != "indexdefs" {
fmt.Fprintf(os.Stderr, "unknown item \"%s\" in --omit option\n", om)
printTry()
os.Exit(2)
Expand Down
4 changes: 3 additions & 1 deletion collector/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,9 @@ func (c *collector) collectDatabase(o CollectConfig) {
}
if !arrayHas(o.Omit, "tables") && !arrayHas(o.Omit, "indexes") {
c.getIndexes(!o.NoSizes)
c.getIndexDef()
if !arrayHas(o.Omit, "indexdefs") {
c.getIndexDef()
}
}
if !arrayHas(o.Omit, "sequences") {
c.getSequences()
Expand Down

0 comments on commit c6034e4

Please sign in to comment.