Skip to content

Commit

Permalink
[mysql] revert default read_timeout (#18097)
Browse files Browse the repository at this point in the history
* revert default read_timeout

* add changelog

(cherry picked from commit 4d47709)
  • Loading branch information
lu-zhengda authored and github-actions[bot] committed Jul 22, 2024
1 parent 902a5a7 commit 5037f9a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
3 changes: 2 additions & 1 deletion mysql/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ files:
- name: read_timeout
description: |
The timeout for reading from the connection in seconds.
The default read timeout is 10 seconds.
By default, no read timeout is set.
value:
type: number
example: 10
display_default: null

- name: ssl
description: |
Expand Down
1 change: 1 addition & 0 deletions mysql/changelog.d/18097.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Revert the default 10s mysql connection read_timeout
2 changes: 1 addition & 1 deletion mysql/datadog_checks/mysql/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, instance):
self.additional_status = instance.get('additional_status', [])
self.additional_variable = instance.get('additional_variable', [])
self.connect_timeout = instance.get('connect_timeout', 10)
self.read_timeout = instance.get('read_timeout', 10)
self.read_timeout = instance.get('read_timeout', None)
self.max_custom_queries = instance.get('max_custom_queries', DEFAULT_MAX_CUSTOM_QUERIES)
self.charset = instance.get('charset')
self.dbm_enabled = is_affirmative(instance.get('dbm', instance.get('deep_database_monitoring', False)))
Expand Down
4 changes: 0 additions & 4 deletions mysql/datadog_checks/mysql/config_models/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,5 @@ def instance_port():
return 3306


def instance_read_timeout():
return 10


def instance_use_global_custom_queries():
return 'true'
4 changes: 2 additions & 2 deletions mysql/datadog_checks/mysql/data/conf.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ instances:
#
# connect_timeout: 10

## @param read_timeout - number - optional - default: 10
## @param read_timeout - number - optional
## The timeout for reading from the connection in seconds.
## The default read timeout is 10 seconds.
## By default, no read timeout is set.
#
# read_timeout: 10

Expand Down
10 changes: 5 additions & 5 deletions mysql/tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_connection_with_defaults_file():
'autocommit': True,
'ssl': None,
'connect_timeout': 10,
'read_timeout': 10,
'read_timeout': None,
'read_default_file': '/foo/bar',
}
assert 'host' not in connection_args
Expand All @@ -45,7 +45,7 @@ def test_connection_with_sock():
'autocommit': True,
'ssl': None,
'connect_timeout': 10,
'read_timeout': 10,
'read_timeout': None,
'unix_socket': '/foo/bar',
'user': 'ddog',
'passwd': 'pwd',
Expand All @@ -65,7 +65,7 @@ def test_connection_with_host():
'autocommit': True,
'ssl': None,
'connect_timeout': 10,
'read_timeout': 10,
'read_timeout': None,
'user': 'ddog',
'passwd': 'pwd',
'host': 'localhost',
Expand All @@ -80,7 +80,7 @@ def test_connection_with_host_and_port():
'autocommit': True,
'ssl': None,
'connect_timeout': 10,
'read_timeout': 10,
'read_timeout': None,
'user': 'ddog',
'passwd': 'pwd',
'host': 'localhost',
Expand All @@ -102,6 +102,6 @@ def test_connection_with_charset(instance_basic):
'port': common.PORT,
'ssl': None,
'connect_timeout': 10,
'read_timeout': 10,
'read_timeout': None,
'charset': 'utf8mb4',
}

0 comments on commit 5037f9a

Please sign in to comment.