Skip to content

Commit 9f34079

Browse files
joeykelroyclaude
andcommitted
[postgres] Clarify relations config requires dbname or database_autodiscovery
The previous description only mentioned `dbname` as a requirement when using the `relations` parameter, omitting `database_autodiscovery` as a valid alternative for collecting relation metrics across all databases. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 24c3c1b commit 9f34079

2 files changed

Lines changed: 51 additions & 46 deletions

File tree

postgres/assets/configuration/spec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ files:
239239
fleet_configurable: true
240240
description: |
241241
The list of relations/tables must be specified here to track per-relation (table, index, view, etc.) metrics.
242-
If enabled, `dbname` should be specified to collect database-specific relations metrics.
242+
If enabled, `dbname` should be specified to collect relations metrics for a single database, or
243+
`database_autodiscovery` should be enabled to collect relation metrics across all databases on the instance.
243244
You can either specify a single relation by its exact name in 'relation_name' or use a regex to track metrics
244245
from all matching relations (useful in cases where relation names are dynamically generated, e.g. TimescaleDB).
245246
Each relation generates many metrics (10 + 10 per index).

postgres/datadog_checks/postgres/data/conf.yaml.example

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ instances:
9797
#
9898
# dbstrict: false
9999

100-
## @param ignore_databases - list of strings - optional - default: ['template0', 'template1', 'rdsadmin', 'azure_maintenance', 'cloudsqladmin', 'alloydbadmin', 'alloydbmetadata']
100+
## @param ignore_databases - list of strings - optional
101101
## A list of databases to ignore. No metrics or statement samples will be collected for these databases.
102102
## Each value can be a plain string or a Postgres pattern. If you want to ignore the postgres database,
103103
## set collect_default_database to false in addition to adding it to this array.
@@ -112,7 +112,7 @@ instances:
112112
# - alloydbadmin
113113
# - alloydbmetadata
114114

115-
## @param ignore_schemas_owned_by - list of strings - optional - default: ['rds_superuser', 'rdsadmin']
115+
## @param ignore_schemas_owned_by - list of strings - optional
116116
## A list of database users which own schemas to ignore.
117117
## No metrics will be collected for these schemas.
118118
## Each value can be a plain string or a Postgres pattern.
@@ -179,9 +179,10 @@ instances:
179179
#
180180
# query_timeout: 5000
181181

182-
## @param relations - (list of string or mapping) - optional - default: []
182+
## @param relations - (list of string or mapping) - optional
183183
## The list of relations/tables must be specified here to track per-relation (table, index, view, etc.) metrics.
184-
## If enabled, `dbname` should be specified to collect database-specific relations metrics.
184+
## If enabled, `dbname` should be specified to collect relations metrics for a single database, or
185+
## `database_autodiscovery` should be enabled to collect relation metrics across all databases on the instance.
185186
## You can either specify a single relation by its exact name in 'relation_name' or use a regex to track metrics
186187
## from all matching relations (useful in cases where relation names are dynamically generated, e.g. TimescaleDB).
187188
## Each relation generates many metrics (10 + 10 per index).
@@ -242,7 +243,7 @@ instances:
242243
#
243244
# collect_activity_metrics: false
244245

245-
## @param activity_metrics_excluded_aggregations - list of strings - optional - default: []
246+
## @param activity_metrics_excluded_aggregations - list of strings - optional
246247
## A list of columns to remove from the pg_stat_activity aggregation.
247248
## By default, datname, usename and application_name will be used.
248249
## If applications with different application_name are creating a lot of short-lived queries,
@@ -314,48 +315,51 @@ instances:
314315
## Each query must have 2 fields, and can have a third optional field:
315316
##
316317
## 1. query - The SQL to execute. It can be a simple statement or a multi-line script.
317-
## Use the pipe `|` if you require a multi-line script.
318+
## Use the pipe `|` if you require a multi-line script.
318319
## 2. columns - The list representing each column, ordered sequentially from left to right.
319-
## The number of columns must equal the number of columns returned in the query.
320-
## There are 2 required pieces of data:
321-
## 1. name - The suffix to append to `<INTEGRATION>.` to form
322-
## the full metric name. If `type` is a `tag` type, this column is considered a tag and applied
323-
## to every metric collected by this particular query.
324-
## 2. type - The submission method (gauge, monotonic_count, etc.).
325-
## This can also be set to the following `tag` types to tag each metric in the row with the name
326-
## and value of the item in this column:
327-
## 1. tag - This is the default tag type
328-
## 2. tag_list - This allows multiple values to be attached to the tag name. For example:
329-
## ```
330-
## query = {
331-
## "name": "example",
332-
## "query": "...",
333-
## "columns": [
334-
## {"name": "server_tag", "type": "tag_list"},
335-
## {"name": "foo", "type": "gauge"},
336-
## ]
337-
## }
338-
## ```
339-
## May result in:
340-
## ```
341-
## gauge("foo", tags=["server_tag:us", "server_tag:primary", "server_tag:default"])
342-
## gauge("foo", tags=["server_tag:eu"])
343-
## gauge("foo", tags=["server_tag:eu", "server_tag:primary"])
344-
## ```
345-
## 3. tag_not_null - This only sets tags in the metric if the value is not null
346-
## You can use the `count` type to perform aggregation for queries that return multiple rows with
347-
## the same or no tags.
348-
## Columns without a name are ignored. To skip a column, enter:
349-
## ```
350-
## - {}
351-
## ```
320+
## The number of columns must equal the number of columns returned in the query.
321+
## There are 2 required pieces of data:
322+
## a. name - The suffix to append to `<INTEGRATION>.` to form
323+
## the full metric name. If `type` is a `tag` type, this column is
324+
## considered a tag and applied to every
325+
## metric collected by this particular query.
326+
## b. type - The submission method (gauge, monotonic_count, etc.).
327+
## This can also be set to the following `tag` types to
328+
## tag each metric in the row with the name and value
329+
## of the item in this column:
330+
## i. tag - This is the default tag type
331+
## ii. tag_list - This allows multiple values to be attached
332+
## to the tag name. For example:
333+
##
334+
## query = {
335+
## "name": "example",
336+
## "query": "...",
337+
## "columns": [
338+
## {"name": "server_tag", "type": "tag_list"},
339+
## {"name": "foo", "type": "gauge"},
340+
## ]
341+
## }
342+
##
343+
## May result in:
344+
## gauge("foo", tags=[
345+
## "server_tag:us",
346+
## "server_tag:primary",
347+
## "server_tag:default"
348+
## ])
349+
## gauge("foo", tags=["server_tag:eu"])
350+
## gauge("foo", tags=["server_tag:eu", "server_tag:primary"])
351+
## iii. tag_not_null - This only sets tags in the metric if the value is not null
352+
## You can use the `count` type to perform aggregation
353+
## for queries that return multiple rows with the same or no tags.
354+
## Columns without a name are ignored. To skip a column, enter:
355+
## - {}
352356
## 3. tags (optional) - A list of tags to apply to each metric.
353357
## 4. collection_interval (optional) - The frequency at which to collect the metrics.
354358
## If collection_interval is not set, the query will be run every check run.
355-
## If the collection interval is less than check collection interval, the query will be run every check
356-
## run.
357-
## If the collection interval is greater than check collection interval, the query will NOT BE RUN
358-
## exactly at the collection interval.
359+
## If the collection interval is less than check collection interval,
360+
## the query will be run every check run.
361+
## If the collection interval is greater than check collection interval,
362+
## the query will NOT BE RUN exactly at the collection interval.
359363
## The query will be run at the next check run after the collection interval has passed.
360364
## 5. metric_prefix (optional) - The prefix to apply to each metric.
361365
#
@@ -568,7 +572,7 @@ instances:
568572
#
569573
# collection_interval: 600
570574

571-
## @param ignored_settings_patterns - list of strings - optional - default: ['plpgsql%']
575+
## @param ignored_settings_patterns - list of strings - optional
572576
## A list of setting patterns to ignore. Any setting key matching one of the values in this list will
573577
## not be collected. This uses the traditional LIKE pattern-matching approach.
574578
#
@@ -614,7 +618,7 @@ instances:
614618
# include_databases:
615619
# - mydb
616620

617-
## @param exclude_databases - list of strings - optional - default: ['template0', 'template1', 'rdsadmin', 'azure_maintenance', 'cloudsqladmin', 'alloydbadmin', 'alloydbmetadata']
621+
## @param exclude_databases - list of strings - optional
618622
## A list of regex patterns to exclude databases.
619623
## Any database whose name matches any one of these patterns will be excluded.
620624
## If empty, all databases matching other filters are included.

0 commit comments

Comments
 (0)