datadog-checks-base 37.3.0__py2.py3-none-any.whl → 37.5.0__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  # (C) Datadog, Inc. 2018-present
2
2
  # All rights reserved
3
3
  # Licensed under a 3-clause BSD style license (see LICENSE)
4
- __version__ = "37.3.0"
4
+ __version__ = "37.5.0"
@@ -1,12 +1,7 @@
1
1
  # (C) Datadog, Inc. 2019-present
2
2
  # All rights reserved
3
3
  # Licensed under a 3-clause BSD style license (see LICENSE)
4
- import sys
5
-
6
- if sys.version_info >= (3, 8):
7
- from importlib.metadata import distributions
8
- else:
9
- from importlib_metadata import distributions
4
+ from importlib.metadata import distributions
10
5
 
11
6
  DATADOG_CHECK_PREFIX = 'datadog-'
12
7
 
@@ -52,6 +52,8 @@ LOGGER = logging.getLogger(__file__)
52
52
  # https://tools.ietf.org/html/rfc2988
53
53
  DEFAULT_TIMEOUT = 10
54
54
 
55
+ DEFAULT_EXPIRATION = 300
56
+
55
57
  # 16 KiB seems optimal, and is also the standard chunk size of the Bittorrent protocol:
56
58
  # https://www.bittorrent.org/beps/bep_0003.html
57
59
  DEFAULT_CHUNK_SIZE = 16
@@ -92,6 +94,7 @@ STANDARD_FIELDS = {
92
94
  'tls_private_key': None,
93
95
  'tls_protocols_allowed': DEFAULT_PROTOCOL_VERSIONS,
94
96
  'tls_verify': True,
97
+ 'tls_ciphers': 'ALL',
95
98
  'timeout': DEFAULT_TIMEOUT,
96
99
  'use_legacy_auth_encoding': True,
97
100
  'username': None,
@@ -153,6 +156,7 @@ class RequestsWrapper(object):
153
156
  'auth_token_handler',
154
157
  'request_size',
155
158
  'tls_protocols_allowed',
159
+ 'tls_ciphers_allowed',
156
160
  )
157
161
 
158
162
  def __init__(self, instance, init_config, remapper=None, logger=None, session=None):
@@ -347,6 +351,14 @@ class RequestsWrapper(object):
347
351
  if config['kerberos_cache']:
348
352
  self.request_hooks.append(lambda: handle_kerberos_cache(config['kerberos_cache']))
349
353
 
354
+ ciphers = config.get('tls_ciphers')
355
+ if ciphers:
356
+ if 'ALL' in ciphers:
357
+ updated_ciphers = "ALL"
358
+ else:
359
+ updated_ciphers = ":".join(ciphers)
360
+ self.tls_ciphers_allowed = updated_ciphers
361
+
350
362
  def get(self, url, **options):
351
363
  return self._request('get', url, options)
352
364
 
@@ -465,6 +477,7 @@ class RequestsWrapper(object):
465
477
  try:
466
478
  context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS)
467
479
  context.verify_mode = ssl.CERT_NONE
480
+ context.set_ciphers(self.tls_ciphers_allowed)
468
481
 
469
482
  with context.wrap_socket(sock, server_hostname=hostname) as secure_sock:
470
483
  der_cert = secure_sock.getpeercert(binary_form=True)
@@ -856,8 +869,16 @@ class AuthTokenOAuthReader(object):
856
869
 
857
870
  # https://www.rfc-editor.org/rfc/rfc6749#section-4.4.3
858
871
  self._token = response['access_token']
859
- self._expiration = get_timestamp() + response['expires_in']
860
-
872
+ self._expiration = get_timestamp()
873
+ try:
874
+ # According to https://www.rfc-editor.org/rfc/rfc6749#section-5.1, the `expires_in` field is optional
875
+ self._expiration += _parse_expires_in(response.get('expires_in'))
876
+ except TypeError:
877
+ LOGGER.debug(
878
+ 'The `expires_in` field of the OAuth2 response is not a number, defaulting to %s',
879
+ DEFAULT_EXPIRATION,
880
+ )
881
+ self._expiration += DEFAULT_EXPIRATION
861
882
  return self._token
862
883
 
863
884
 
@@ -991,6 +1012,21 @@ def quote_uds_url(url):
991
1012
  return urlunparse(parsed)
992
1013
 
993
1014
 
1015
+ def _parse_expires_in(token_expiration):
1016
+ if isinstance(token_expiration, int) or isinstance(token_expiration, float):
1017
+ return token_expiration
1018
+ if isinstance(token_expiration, str):
1019
+ try:
1020
+ token_expiration = int(token_expiration)
1021
+ except ValueError:
1022
+ LOGGER.debug('Could not convert %s to an integer', token_expiration)
1023
+ else:
1024
+ LOGGER.debug('Unexpected type for `expires_in`: %s.', type(token_expiration))
1025
+ token_expiration = None
1026
+
1027
+ return token_expiration
1028
+
1029
+
994
1030
  # For documentation generation
995
1031
  # TODO: use an enum and remove STANDARD_FIELDS when mkdocstrings supports it
996
1032
  class StandardFields(object):
@@ -28,6 +28,7 @@ STANDARD_FIELDS = {
28
28
  'tls_private_key': None,
29
29
  'tls_private_key_password': None,
30
30
  'tls_validate_hostname': True,
31
+ 'tls_ciphers': 'ALL',
31
32
  }
32
33
 
33
34
 
@@ -115,6 +116,15 @@ class TlsContextWrapper(object):
115
116
  else:
116
117
  context.check_hostname = False
117
118
 
119
+ ciphers = self.config.get('tls_ciphers')
120
+ if ciphers:
121
+ if 'ALL' in ciphers:
122
+ updated_ciphers = "ALL"
123
+ else:
124
+ updated_ciphers = ":".join(ciphers)
125
+
126
+ context.set_ciphers(updated_ciphers)
127
+
118
128
  # https://docs.python.org/3/library/ssl.html#ssl.SSLContext.load_verify_locations
119
129
  # https://docs.python.org/3/library/ssl.html#ssl.SSLContext.load_default_certs
120
130
  ca_cert = self.config['tls_ca_cert']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datadog-checks-base
3
- Version: 37.3.0
3
+ Version: 37.5.0
4
4
  Summary: The Datadog Check Toolkit
5
5
  Project-URL: Source, https://github.com/DataDog/integrations-core
6
6
  Author-email: Datadog <packages@datadoghq.com>
@@ -13,40 +13,39 @@ Classifier: License :: OSI Approved :: BSD License
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Topic :: System :: Monitoring
15
15
  Provides-Extra: db
16
- Requires-Dist: mmh3==4.1.0; extra == 'db'
16
+ Requires-Dist: mmh3==5.0.1; extra == 'db'
17
17
  Provides-Extra: deps
18
18
  Requires-Dist: binary==1.0.1; extra == 'deps'
19
19
  Requires-Dist: cachetools==5.5.0; extra == 'deps'
20
20
  Requires-Dist: cryptography==43.0.1; extra == 'deps'
21
21
  Requires-Dist: ddtrace==2.10.6; extra == 'deps'
22
- Requires-Dist: importlib-metadata==2.1.3; (python_version < '3.8') and extra == 'deps'
23
- Requires-Dist: jellyfish==1.1.0; extra == 'deps'
24
- Requires-Dist: prometheus-client==0.20.0; extra == 'deps'
25
- Requires-Dist: protobuf==5.27.3; extra == 'deps'
26
- Requires-Dist: pydantic==2.8.2; extra == 'deps'
22
+ Requires-Dist: jellyfish==1.1.3; extra == 'deps'
23
+ Requires-Dist: prometheus-client==0.21.1; extra == 'deps'
24
+ Requires-Dist: protobuf==5.29.3; extra == 'deps'
25
+ Requires-Dist: pydantic==2.10.5; extra == 'deps'
27
26
  Requires-Dist: python-dateutil==2.9.0.post0; extra == 'deps'
28
- Requires-Dist: pywin32==306; (sys_platform == 'win32') and extra == 'deps'
27
+ Requires-Dist: pywin32==308; (sys_platform == 'win32') and extra == 'deps'
29
28
  Requires-Dist: pyyaml==6.0.2; extra == 'deps'
30
29
  Requires-Dist: requests-toolbelt==1.0.0; extra == 'deps'
31
30
  Requires-Dist: requests-unixsocket2==0.4.2; extra == 'deps'
32
31
  Requires-Dist: requests==2.32.3; extra == 'deps'
33
32
  Requires-Dist: simplejson==3.19.3; extra == 'deps'
34
33
  Requires-Dist: uptime==3.0.1; extra == 'deps'
35
- Requires-Dist: wrapt==1.16.0; extra == 'deps'
34
+ Requires-Dist: wrapt==1.17.2; extra == 'deps'
36
35
  Provides-Extra: http
37
36
  Requires-Dist: aws-requests-auth==0.4.3; extra == 'http'
38
- Requires-Dist: botocore==1.35.10; extra == 'http'
37
+ Requires-Dist: botocore==1.36.1; extra == 'http'
39
38
  Requires-Dist: oauthlib==3.2.2; extra == 'http'
40
- Requires-Dist: pyjwt==2.9.0; extra == 'http'
39
+ Requires-Dist: pyjwt==2.10.1; extra == 'http'
41
40
  Requires-Dist: pyopenssl==24.2.1; extra == 'http'
42
41
  Requires-Dist: pysocks==1.7.1; extra == 'http'
43
42
  Requires-Dist: requests-kerberos==0.15.0; extra == 'http'
44
43
  Requires-Dist: requests-ntlm==1.3.0; extra == 'http'
45
44
  Requires-Dist: requests-oauthlib==2.0.0; extra == 'http'
46
45
  Provides-Extra: json
47
- Requires-Dist: orjson==3.10.7; extra == 'json'
46
+ Requires-Dist: orjson==3.10.14; extra == 'json'
48
47
  Provides-Extra: kube
49
- Requires-Dist: kubernetes==30.1.0; extra == 'kube'
48
+ Requires-Dist: kubernetes==31.0.0; extra == 'kube'
50
49
  Requires-Dist: requests-oauthlib==2.0.0; extra == 'kube'
51
50
  Description-Content-Type: text/markdown
52
51
 
@@ -3,7 +3,7 @@ datadog_checks/config.py,sha256=PrAXGdlLnoV2VMQff_noSaSJJ0wg4BAiGnw7jCQLSik,196
3
3
  datadog_checks/errors.py,sha256=eFwmnrX-batIgbu-iJyseqAPNO_4rk1UuaKK89evLhg,155
4
4
  datadog_checks/log.py,sha256=orvOgMKGNEsqSTLalCAQpWP-ouorpG1A7Gn-j2mRD80,301
5
5
  datadog_checks/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
6
- datadog_checks/base/__about__.py,sha256=QRM3_bwJhzb7uJLn2DucBJ-GivjWqyQ1VQY7Sj8SWC8,138
6
+ datadog_checks/base/__about__.py,sha256=5AzFfItx9URe8lFWie_oC3dNfFosQs7be2xVIkuGnko,138
7
7
  datadog_checks/base/__init__.py,sha256=rSTDo6-2p_RX6I6wnuXrNMglaatoLRyZFTE5wbHZY8s,1466
8
8
  datadog_checks/base/agent.py,sha256=nX9x_BYYizRKGNYfXq5z7S0FZ9xcX_wd2tuxpGe3_8k,350
9
9
  datadog_checks/base/config.py,sha256=qcAA4X9sXQZRdwQe8DgiGd2980VBp1SQA0d695tX_tU,604
@@ -101,7 +101,7 @@ datadog_checks/base/utils/diagnose.py,sha256=eLMe0tISpkzS3yxVR83IHxorQJfHT_Xi6Cq
101
101
  datadog_checks/base/utils/fips.py,sha256=G92RNoZkrMojaTKi1DiccbvfMFO3adktDZgKjpxkkTw,1400
102
102
  datadog_checks/base/utils/functions.py,sha256=iGlybxR6aPPElNxNb2ELOzbk328j9OVBAxredJxdCRw,695
103
103
  datadog_checks/base/utils/headers.py,sha256=0SSdC71jwaB61BODfusahCVr1c56GvT9iwt7cidcHP0,1779
104
- datadog_checks/base/utils/http.py,sha256=MWmPVsCQEkl02X0J4gIte1ACjB3LeK3cwZL2gPDhIX8,39116
104
+ datadog_checks/base/utils/http.py,sha256=TcOdwoFKggxr_VsCEQoXlxFFGS-n9UYz4pDZH2zxjoM,40516
105
105
  datadog_checks/base/utils/limiter.py,sha256=YRTrPCX1S5EtHLVcP_-GEfzRots_LTcy1f_uHZVs90g,3027
106
106
  datadog_checks/base/utils/network.py,sha256=YXo9JQgWUtFn4dFefWZap20OMmSReLSPOjgzodJbddw,1814
107
107
  datadog_checks/base/utils/platform.py,sha256=wW8f6XKo4JHxvu1sN0DpLDmYjS_cCu8GoKvfTjIj4yM,2499
@@ -112,14 +112,14 @@ datadog_checks/base/utils/tagging.py,sha256=AEUEGIxJjNvoOIEQQFkit8ZT2OyRxiym1FzC
112
112
  datadog_checks/base/utils/tailfile.py,sha256=x_pM5pgmVaW4eJBwS6GXZKOqifpmqfrwHOU3gWthYtM,3894
113
113
  datadog_checks/base/utils/time.py,sha256=cNy7CtsJzSUMi7J-3WReZVUvNyYOGkJwItqJMY01qqA,1373
114
114
  datadog_checks/base/utils/timeout.py,sha256=eOBZofFN-hOu5xJeMOF3ac_ofcy9EY6-kvmBvP4QEFg,2140
115
- datadog_checks/base/utils/tls.py,sha256=MUoZbAZKDMTeVRK0SDmYYIigyCjOJTi1YFBoE6zps8M,5411
115
+ datadog_checks/base/utils/tls.py,sha256=m_puDc6JGhVqJ0ADqeA736H05DuaNKrLAE9pPMUJCDo,5700
116
116
  datadog_checks/base/utils/tracing.py,sha256=NPt5h-QXT_XL8D2FhNlNbBO-Lnwrr_sdS4DFpKRV9IU,5759
117
117
  datadog_checks/base/utils/tracking.py,sha256=FYIouqu3KB-JsxgxM1iX5Ipv_cWhs8zQOTN4SxXOkJ4,3701
118
118
  datadog_checks/base/utils/agent/__init__.py,sha256=o3aWvy3PhykD_h7YT3s628O0W2YpHis0NlQsSV1PI04,115
119
119
  datadog_checks/base/utils/agent/common.py,sha256=1XRsPJWdpmbxAKKBVHGBPUm4WHdviq0ovuggtpx7LWo,217
120
120
  datadog_checks/base/utils/agent/debug.py,sha256=zeBbNLt3Y_Wxpf9OdAklldLy1gmL0U6bMDmOHSDGM3M,2274
121
121
  datadog_checks/base/utils/agent/memory.py,sha256=mG10PFFgjWCLetF6ihC463VQz1V3S4STMs_F8bADkvY,10514
122
- datadog_checks/base/utils/agent/packages.py,sha256=q4i77Oj50KONsRTxIbOqe6v0Mjneu-QGndI2z8dC2Pk,633
122
+ datadog_checks/base/utils/agent/packages.py,sha256=mpkkq01sizzz-0Mdbd_t_deMakHAX1oiZ1rSFGD-luE,531
123
123
  datadog_checks/base/utils/agent/utils.py,sha256=FV_o6rccU5B0MrXyma-4yAqmKghklzTeOf1nhYcmY7o,1360
124
124
  datadog_checks/base/utils/concurrency/__init__.py,sha256=ORssE5bXZuYua5UCLesGfPvcrQKcADHaDsXrUyfARF0,115
125
125
  datadog_checks/base/utils/concurrency/limiter.py,sha256=is2ZpUEjfsI4nBGtXG2D0Zgv0GD38_i5jJQCkdzPW_Y,3170
@@ -200,6 +200,6 @@ datadog_checks/utils/tracing.py,sha256=HQbQakKM-Lw75MDkItaYJYipS6YO24Z_ymDVxDsx5
200
200
  datadog_checks/utils/prometheus/__init__.py,sha256=8WwXnM9g1sfS5267QYCJX_hd8MZl5kRgBgQ_SzdNdXs,161
201
201
  datadog_checks/utils/prometheus/functions.py,sha256=4vWsTGLgujHwdYZo0tlAQkqDPHofqUJM3k9eItJqERQ,197
202
202
  datadog_checks/utils/prometheus/metrics_pb2.py,sha256=xg3UdUHe4TjeR4s13LUKZ2U1WVSt6U6zjsVRG6lX6dc,173
203
- datadog_checks_base-37.3.0.dist-info/METADATA,sha256=VlGpxGtTRr5mXjDKJMVVrEc2qC0m5XO2yDNPMAs-6lA,3675
204
- datadog_checks_base-37.3.0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
205
- datadog_checks_base-37.3.0.dist-info/RECORD,,
203
+ datadog_checks_base-37.5.0.dist-info/METADATA,sha256=GZWGd2TVn8CrN5OELUHpk6gXVM5OejdzkZnkcHXfpWc,3590
204
+ datadog_checks_base-37.5.0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
205
+ datadog_checks_base-37.5.0.dist-info/RECORD,,