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
dog script's service_check, monitor options are not required, but are still sent (as null) when not provided. Assuming this is the behavior for all script commands.
Reproduce:
$ dog service_check check check_pg host0 0
ERROR: "message" parameter should be a string
The actual payload / body sent to server includes nulled options, when not specified.
This could be fixed locally in datadog.dogshell.service_checkto not submitNoneoptions; or this could be fixed indatadog.api.service_checksordatadog.api.api_client`.
The first would have the most localized effect / least possibility for wider side effects to other tests, but if there are no cases for submitting null values to the DataDog API, then I would definitely recommend mitigating this directly in datadog.api.api_client.
The text was updated successfully, but these errors were encountered:
The commits that fixed this introduced a python error:
root@tvisher1:~# dog service_check check check_filebeat "$(hostname)" 2
Traceback (most recent call last):
File "/usr/local/bin/dog", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.4/dist-packages/datadog/dogshell/__init__.py", line 69, in main
args.func(args)
File "/usr/local/lib/python3.4/dist-packages/datadog/dogshell/service_check.py", line 34, in _check
timestamp=args.timestamp, message=args.message, tags=args.tags)
File "/usr/local/lib/python3.4/dist-packages/datadog/api/service_checks.py", line 37, in check
for param, value in params.items():
RuntimeError: dictionary changed size during iteration
r
I applied the following patch and it worked well.
--- /usr/local/lib/python3.4/dist-packages/datadog/api/service_checks.orig.py 2017-11-10 11:00:23.925812101 -0500
+++ /usr/local/lib/python3.4/dist-packages/datadog/api/service_checks.py 2017-11-10 11:00:43.198480330 -0500
@@ -35,9 +35,7 @@
# Validate checks, include only non-null values
for param, value in params.items():
- if value is None:
- del params[param]
- elif param == 'status' and params[param] not in CheckStatus.ALL:
+ if param == 'status' and params[param] not in CheckStatus.ALL:
raise ApiError('Invalid status, expected one of: %s'
% ', '.join(str(v) for v in CheckStatus.ALL))
dog
script'sservice_check
,monitor
options are not required, but are still sent (as null) when not provided. Assuming this is the behavior for all script commands.Reproduce:
$ dog service_check check check_pg host0 0 ERROR: "message" parameter should be a string
The actual payload / body sent to server includes nulled options, when not specified.
Relates:
https://github.com/DataDog/datadogpy/blob/master/datadog/dogshell/service_check.py#L32
https://github.com/DataDog/datadogpy/blob/master/datadog/api/service_checks.py#L39
https://github.com/DataDog/datadogpy/blob/master/datadog/api/api_client.py#L112
https://github.com/DataDog/datadogpy/blob/master/datadog/api/api_client.py#L127
This could be fixed locally in datadog.dogshell.service_check
to not submit
Noneoptions; or this could be fixed in
datadog.api.service_checksor
datadog.api.api_client`.The first would have the most localized effect / least possibility for wider side effects to other tests, but if there are no cases for submitting null values to the DataDog API, then I would definitely recommend mitigating this directly in
datadog.api.api_client
.The text was updated successfully, but these errors were encountered: