Skip to content

Commit 10462ff

Browse files
author
Yann MAHE
committed
[debug] improve run_check compatibility
Datadog Agent checks do not necessarily inherit directly from the `AgentCheck` class. When it is the case, the `run_check` DEBUG method would fail loading the check. This happens with WMI checks for instance. Allow the `run_check` DEBUG method to load any agent check that inherits from the `AgentCheck`.
1 parent 5ec8e39 commit 10462ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

utils/debug.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def get_check(name, config_str):
5252
check_class = None
5353
classes = inspect.getmembers(check_module, inspect.isclass)
5454
for name, clsmember in classes:
55-
if AgentCheck in clsmember.__bases__:
55+
if issubclass(clsmember, AgentCheck) and clsmember != AgentCheck:
5656
check_class = clsmember
5757
break
5858
if check_class is None:

0 commit comments

Comments
 (0)