datadog-checks-base 37.17.1__py2.py3-none-any.whl → 37.18.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.
- datadog_checks/base/__about__.py +1 -1
- datadog_checks/base/utils/db/health.py +82 -0
- {datadog_checks_base-37.17.1.dist-info → datadog_checks_base-37.18.0.dist-info}/METADATA +1 -1
- {datadog_checks_base-37.17.1.dist-info → datadog_checks_base-37.18.0.dist-info}/RECORD +5 -4
- {datadog_checks_base-37.17.1.dist-info → datadog_checks_base-37.18.0.dist-info}/WHEEL +0 -0
datadog_checks/base/__about__.py
CHANGED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# (C) Datadog, Inc. 2025-present
|
|
2
|
+
# All rights reserved
|
|
3
|
+
# Licensed under a 3-clause BSD style license (see LICENSE)
|
|
4
|
+
# This is the base implementation of the Agent Health reporting system.
|
|
5
|
+
# It provides a structure for health events and codes that can be extended by specific checks.
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import time
|
|
10
|
+
from typing import TYPE_CHECKING
|
|
11
|
+
|
|
12
|
+
from datadog_checks.base.utils.serialization import json
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from datadog_checks.base import AgentCheck
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
import datadog_agent
|
|
19
|
+
except ImportError:
|
|
20
|
+
from datadog_checks.base.stubs import datadog_agent
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
from enum import Enum
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class HealthEvent(Enum):
|
|
27
|
+
"""
|
|
28
|
+
Enum representing the health events.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
INITIALIZATION = 'initialization'
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class HealthStatus(Enum):
|
|
35
|
+
"""
|
|
36
|
+
Enum representing the health statuses for a given event.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
OK = 'ok'
|
|
40
|
+
WARNING = 'warning'
|
|
41
|
+
ERROR = 'error'
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class Health:
|
|
45
|
+
def __init__(self, check: AgentCheck):
|
|
46
|
+
"""
|
|
47
|
+
Initialize the HealthCheck instance.
|
|
48
|
+
|
|
49
|
+
:param check: AgentCheck
|
|
50
|
+
The check instance that will be used to submit health events.
|
|
51
|
+
"""
|
|
52
|
+
self.check = check
|
|
53
|
+
|
|
54
|
+
def submit_health_event(self, name: HealthEvent, status: HealthStatus, tags: list[str] = None, **kwargs):
|
|
55
|
+
"""
|
|
56
|
+
Submit a health event to the aggregator.
|
|
57
|
+
|
|
58
|
+
:param name: HealthEvent
|
|
59
|
+
The name of the health event.
|
|
60
|
+
:param status: HealthStatus
|
|
61
|
+
The health status to submit.
|
|
62
|
+
:param tags: list of str
|
|
63
|
+
Tags to associate with the health event.
|
|
64
|
+
:param kwargs: Additional keyword arguments to include in the event under `data`.
|
|
65
|
+
"""
|
|
66
|
+
self.check.event_platform_event(
|
|
67
|
+
json.dumps(
|
|
68
|
+
{
|
|
69
|
+
'timestamp': time.time() * 1000,
|
|
70
|
+
'version': 1,
|
|
71
|
+
'check_id': self.check.check_id,
|
|
72
|
+
'category': self.check.__NAMESPACE__ or self.check.__class__.__name__.lower(),
|
|
73
|
+
'name': name,
|
|
74
|
+
'status': status,
|
|
75
|
+
'tags': tags or [],
|
|
76
|
+
'ddagentversion': datadog_agent.get_version(),
|
|
77
|
+
'ddagenthostname': datadog_agent.get_hostname(),
|
|
78
|
+
'data': {**kwargs},
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
"dbm-health",
|
|
82
|
+
)
|
|
@@ -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=
|
|
6
|
+
datadog_checks/base/__about__.py,sha256=d8C_Jbdb_6t4htu9xHzfa7q7A7J7mafa2rOZW7HXkNg,139
|
|
7
7
|
datadog_checks/base/__init__.py,sha256=yWegSLE-TZWIGSvAiJj9PSrUxzlOo_UVJLt2zORZ8Ek,363
|
|
8
8
|
datadog_checks/base/__init__.pyi,sha256=eH8XhrtvnD6uE6FWfEyCmKwOaaLJxNolS08D6IRHZuU,995
|
|
9
9
|
datadog_checks/base/agent.py,sha256=nX9x_BYYizRKGNYfXq5z7S0FZ9xcX_wd2tuxpGe3_8k,350
|
|
@@ -138,6 +138,7 @@ datadog_checks/base/utils/concurrency/limiter.py,sha256=is2ZpUEjfsI4nBGtXG2D0Zgv
|
|
|
138
138
|
datadog_checks/base/utils/db/__init__.py,sha256=EVTc2FtnHWLHXI3M79jyMn9ypZAMa9eqG3EKLAiMF-M,211
|
|
139
139
|
datadog_checks/base/utils/db/__init__.pyi,sha256=ewmGxxyJ52wAaYxNZahi2koEUnddfvHcn3HYxQ3RUr0,240
|
|
140
140
|
datadog_checks/base/utils/db/core.py,sha256=bYanwXIqBzsSxK7b-Ofb0W1WiHbFBtKyYdUBonBLe_Q,11165
|
|
141
|
+
datadog_checks/base/utils/db/health.py,sha256=OWdhGSUhEr8Rxr6anVxD__52wkG8kDaY7M015Y4fCkA,2361
|
|
141
142
|
datadog_checks/base/utils/db/query.py,sha256=-PyxdqpbShkQ78h7sWnghQZVtjdLGVrm71n8OpHuPW4,14432
|
|
142
143
|
datadog_checks/base/utils/db/sql.py,sha256=oiEzQa_vC_w3U65VFrFCoQHWj5GQLLRlSO0CfiSlp4A,2490
|
|
143
144
|
datadog_checks/base/utils/db/sql_commenter.py,sha256=r_efK6TGRQxM_-Qj-ndEJdECk47J4nCFjkVyxu1XmvU,1522
|
|
@@ -219,6 +220,6 @@ datadog_checks/utils/tracing.py,sha256=HQbQakKM-Lw75MDkItaYJYipS6YO24Z_ymDVxDsx5
|
|
|
219
220
|
datadog_checks/utils/prometheus/__init__.py,sha256=8WwXnM9g1sfS5267QYCJX_hd8MZl5kRgBgQ_SzdNdXs,161
|
|
220
221
|
datadog_checks/utils/prometheus/functions.py,sha256=4vWsTGLgujHwdYZo0tlAQkqDPHofqUJM3k9eItJqERQ,197
|
|
221
222
|
datadog_checks/utils/prometheus/metrics_pb2.py,sha256=xg3UdUHe4TjeR4s13LUKZ2U1WVSt6U6zjsVRG6lX6dc,173
|
|
222
|
-
datadog_checks_base-37.
|
|
223
|
-
datadog_checks_base-37.
|
|
224
|
-
datadog_checks_base-37.
|
|
223
|
+
datadog_checks_base-37.18.0.dist-info/METADATA,sha256=14te5AqGZkd64H3TUo-Ro0hJdsgaPGFJs4iuKM-TQFA,4244
|
|
224
|
+
datadog_checks_base-37.18.0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
|
225
|
+
datadog_checks_base-37.18.0.dist-info/RECORD,,
|
|
File without changes
|