Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add query_path and disable_default_metrics to postgres_exporter #425

Merged
merged 1 commit into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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