You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write a custom check such as /etc/dd-agent/checks.d/example.py with a syntax error:
from checks import AgentCheck
class ExampleCheck(AgentCheck):
def check(self, instance):
self.gauge('hello.world', 1)
Create the corresponding yaml file in /etc/dd-agent/conf.d/example.yaml:
init_config:
instances:
[{}]
sudo /etc/init.d/datadog-agent restart
sudo /etc/init.d/datadog-agent info
Describe the results you received:
The above-described error output, ultimately leading only as far as error in line 546 of check_status.py:
TypeError: object of type 'NoneType' has no len()
Describe the results you expected:
A handled exception with meaningful output that stipulates there is a syntax error in a custom check.
Ideally it either raises the root-cause custom check exception that shows the responsible line of code, or provides information which custom check triggered the exception to allow separate debugging.
Additional information you deem important (e.g. issue happens only occasionally):
While this should be encountered with all types of syntax errors, in some specific cases where checking with Python for syntax errors on one host succeeds, but it fails on another, can result in confusion about what has caused the issue, leading to many hours of "black-box" debugging that can be avoided with an indication of the custom check having a syntax error when ran by the agent.
The text was updated successfully, but these errors were encountered:
insideClaw
changed the title
[status_check] Unhandled exception when calling a custom check with syntax error
[status_check] Unhandled exception when calling a custom check with syntax errors
Aug 10, 2017
Excellent, I'm glad you found it well put.
Also that I'm not misguided of it being an issue - the Datadog support person who I spoke to was originally convincing me that's normal Python behaviour :)
Good luck with the fix and I'll be looking forward to your release.
**Output of the info page **
Additional environment details (Operating System, Cloud provider, etc):
4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
VERSION="16.04.3 LTS (Xenial Xerus)"
Steps to reproduce the issue:
Describe the results you received:
The above-described error output, ultimately leading only as far as error in line 546 of check_status.py:
TypeError: object of type 'NoneType' has no len()
Describe the results you expected:
A handled exception with meaningful output that stipulates there is a syntax error in a custom check.
Ideally it either raises the root-cause custom check exception that shows the responsible line of code, or provides information which custom check triggered the exception to allow separate debugging.
Additional information you deem important (e.g. issue happens only occasionally):
While this should be encountered with all types of syntax errors, in some specific cases where checking with Python for syntax errors on one host succeeds, but it fails on another, can result in confusion about what has caused the issue, leading to many hours of "black-box" debugging that can be avoided with an indication of the custom check having a syntax error when ran by the agent.
The text was updated successfully, but these errors were encountered: