Skip to content

Commit

Permalink
add query_path and disable_default_metrics to postgres_exporter (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfratto authored Feb 23, 2021
1 parent 4849374 commit 1521266
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ can be found at [#317](https://github.com/grafana/agent/issues/317).
The primary branch name has changed from `master` to `main`. You may have to
update your local checkouts of the repository to point at the new branch name.

- [FEATURE] postgres_exporter: Support query_path and disable_default_metrics. (@rfratto)

- [ENHANCEMENT] Support other architectures in installation script. (@rfratto)

- [ENHANCEMENT] Allow specifying custom wal_truncate_frequency per integration.
Expand Down
8 changes: 8 additions & 0 deletions docs/configuration-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3187,6 +3187,14 @@ Full reference of options:
# is true.
exclude_databases:
[ - <string> ]
# Path to a YAML file containing custom queries to run. Check out
# postgres_exporter's queries.yaml for examples of the format:
# https://github.com/prometheus-community/postgres_exporter/blob/master/queries.yaml
[query_path: <string> | default = ""]
# When true, only exposes metrics supplied from query_path.
[disable_default_metrics: <boolean> | default = false]
```

### statsd_exporter_config
Expand Down
5 changes: 4 additions & 1 deletion pkg/integrations/postgres_exporter/postgres_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ type Config struct {
DisableSettingsMetrics bool `yaml:"disable_settings_metrics"`
AutodiscoverDatabases bool `yaml:"autodiscover_databases"`
ExcludeDatabases []string `yaml:"exclude_databases"`
DisableDefaultMetrics bool `yaml:"disable_default_metrics"`
QueryPath string `yaml:"query_path"`
}

// UnmarshalYAML implements yaml.Unmarshaler for Config.
Expand Down Expand Up @@ -63,7 +65,8 @@ func New(log log.Logger, c *Config) (integrations.Integration, error) {

e := exporter.NewExporter(
dsn,
exporter.DisableDefaultMetrics(false),
exporter.DisableDefaultMetrics(c.DisableDefaultMetrics),
exporter.WithUserQueriesPath(c.QueryPath),
exporter.DisableSettingsMetrics(c.DisableSettingsMetrics),
exporter.AutoDiscoverDatabases(c.AutodiscoverDatabases),
exporter.ExcludeDatabases(strings.Join(c.ExcludeDatabases, ",")),
Expand Down

0 comments on commit 1521266

Please sign in to comment.