From 7dcf1dc7b631c38b889f843aa4e5601a119fcfe3 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Tue, 13 Jun 2023 17:39:39 +0200 Subject: [PATCH] Deprecate extend queries feature (#811) Mark the extend queries feature as deprecated in favor of recommending the sql_exporter. Signed-off-by: SuperQ --- README.md | 6 ++++-- cmd/postgres_exporter/main.go | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b54b4b63..9f5222c1 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ This will build the docker image as `prometheuscommunity/postgres_exporter:${bra * `auto-discover-databases` Whether to discover the databases on a server dynamically. Default is `false`. -* `extend.query-path` +* `extend.query-path` (DEPRECATED) Path to a YAML file containing custom queries to run. Check out [`queries.yaml`](queries.yaml) for examples of the format. @@ -222,7 +222,9 @@ for l in StringIO(x): Adjust the value of the resultant prometheus value type appropriately. This helps build rich self-documenting metrics for the exporter. -### Adding new metrics via a config file +### Adding new metrics via a config file (DEPRECATED) + +This feature is deprecated in favor of built-in collector functions. For generic SQL database monitoring see the [sql_exporter](https://github.com/burningalchemist/sql_exporter). The -extend.query-path command-line argument specifies a YAML file containing additional queries to run. Some examples are provided in [queries.yaml](queries.yaml). diff --git a/cmd/postgres_exporter/main.go b/cmd/postgres_exporter/main.go index 04dd6e7c..cab3fcab 100644 --- a/cmd/postgres_exporter/main.go +++ b/cmd/postgres_exporter/main.go @@ -44,7 +44,7 @@ var ( disableDefaultMetrics = kingpin.Flag("disable-default-metrics", "Do not include default metrics.").Default("false").Envar("PG_EXPORTER_DISABLE_DEFAULT_METRICS").Bool() disableSettingsMetrics = kingpin.Flag("disable-settings-metrics", "Do not include pg_settings metrics.").Default("false").Envar("PG_EXPORTER_DISABLE_SETTINGS_METRICS").Bool() autoDiscoverDatabases = kingpin.Flag("auto-discover-databases", "Whether to discover the databases on a server dynamically.").Default("false").Envar("PG_EXPORTER_AUTO_DISCOVER_DATABASES").Bool() - queriesPath = kingpin.Flag("extend.query-path", "Path to custom queries to run.").Default("").Envar("PG_EXPORTER_EXTEND_QUERY_PATH").String() + queriesPath = kingpin.Flag("extend.query-path", "Path to custom queries to run. (DEPRECATED)").Default("").Envar("PG_EXPORTER_EXTEND_QUERY_PATH").String() onlyDumpMaps = kingpin.Flag("dumpmaps", "Do not run, simply dump the maps.").Bool() constantLabelsList = kingpin.Flag("constantLabels", "A list of label=value separated by comma(,).").Default("").Envar("PG_EXPORTER_CONSTANT_LABELS").String() excludeDatabases = kingpin.Flag("exclude-databases", "A list of databases to remove when autoDiscoverDatabases is enabled").Default("").Envar("PG_EXPORTER_EXCLUDE_DATABASES").String() @@ -95,6 +95,10 @@ func main() { excludedDatabases := strings.Split(*excludeDatabases, ",") logger.Log("msg", "Excluded databases", "databases", fmt.Sprintf("%v", excludedDatabases)) + if *queriesPath != "" { + level.Warn(logger).Log("msg", "The extend queries.yaml config is DEPRECATD", "file", *queriesPath) + } + opts := []ExporterOpt{ DisableDefaultMetrics(*disableDefaultMetrics), DisableSettingsMetrics(*disableSettingsMetrics),