Skip to content

Commit 717d94d

Browse files
authored
Add exclude_hostname to Postgres and MySQL specs (#20258)
* Add exclude_hostname to Postgres and MySQL specs * Validate
1 parent 7d3803c commit 717d94d

File tree

8 files changed

+34
-0
lines changed

8 files changed

+34
-0
lines changed

mysql/assets/configuration/spec.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ files:
7070
and can be useful to set a custom hostname when connecting to a remote database through a proxy.
7171
value:
7272
type: string
73+
- name: exclude_hostname
74+
description: |
75+
Omit the hostname from tags and events. This is useful when the database host is not monitored by an agent.
76+
value:
77+
type: boolean
78+
example: false
79+
default: false
7380
- name: database_identifier
7481
description: |
7582
Controls how the database is identified. The default value is the resolved hostname for the instance,

mysql/datadog_checks/mysql/config_models/defaults.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ def instance_empty_default_hostname():
3232
return False
3333

3434

35+
def instance_exclude_hostname():
36+
return False
37+
38+
3539
def instance_log_unobfuscated_plans():
3640
return False
3741

mysql/datadog_checks/mysql/config_models/instance.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ class InstanceConfig(BaseModel):
224224
defaults_file: Optional[str] = None
225225
disable_generic_tags: Optional[bool] = None
226226
empty_default_hostname: Optional[bool] = None
227+
exclude_hostname: Optional[bool] = None
227228
gcp: Optional[Gcp] = None
228229
host: Optional[str] = None
229230
index_metrics: Optional[IndexMetrics] = None

mysql/datadog_checks/mysql/data/conf.yaml.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ instances:
6464
#
6565
# reported_hostname: <REPORTED_HOSTNAME>
6666

67+
## @param exclude_hostname - boolean - optional - default: false
68+
## Omit the hostname from tags and events. This is useful when the database host is not monitored by an agent.
69+
#
70+
# exclude_hostname: false
71+
6772
## Controls how the database is identified. The default value is the resolved hostname for the instance,
6873
## which respects the `reported_hostname` option.
6974
##

postgres/assets/configuration/spec.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ files:
5151
and can be useful to set a custom hostname when connecting to a remote database through a proxy.
5252
value:
5353
type: string
54+
- name: exclude_hostname
55+
description: |
56+
Omit the hostname from tags and events. This is useful when the database host is not monitored by an agent.
57+
value:
58+
type: boolean
59+
example: false
60+
default: false
5461
- name: database_identifier
5562
description: |
5663
Controls how the database is identified. The default value is the resolved hostname for the instance,

postgres/datadog_checks/postgres/config_models/defaults.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ def instance_empty_default_hostname():
8484
return False
8585

8686

87+
def instance_exclude_hostname():
88+
return False
89+
90+
8791
def instance_idle_connection_timeout():
8892
return 60000
8993

postgres/datadog_checks/postgres/config_models/instance.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ class InstanceConfig(BaseModel):
257257
dbstrict: Optional[bool] = None
258258
disable_generic_tags: Optional[bool] = None
259259
empty_default_hostname: Optional[bool] = None
260+
exclude_hostname: Optional[bool] = None
260261
gcp: Optional[Gcp] = None
261262
host: str
262263
idle_connection_timeout: Optional[int] = None

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ instances:
6464
#
6565
# reported_hostname: <REPORTED_HOSTNAME>
6666

67+
## @param exclude_hostname - boolean - optional - default: false
68+
## Omit the hostname from tags and events. This is useful when the database host is not monitored by an agent.
69+
#
70+
# exclude_hostname: false
71+
6772
## Controls how the database is identified. The default value is the resolved hostname for the instance,
6873
## which respects the `reported_hostname` option.
6974
##

0 commit comments

Comments
 (0)