Skip to content

Dogshell.dog service_check, monitor includes null values #206

@ronindesign

Description

@ronindesign

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.

{"status": 0, "tags": null, "timestamp": null, "host_name": "host0", "message": null, "check": "check_pg"}

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_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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions