datadog-api-client-python icon indicating copy to clipboard operation
datadog-api-client-python copied to clipboard

v1 list_monitors cannot find monitor tags with spaces

Open chris-kiick-sp opened this issue 2 years ago • 2 comments

Describe the bug If a monitor has a tag whose key has spaces in it, then list_monitors() cannot find it by tag.

To Reproduce

  1. Go to 'Monitors'
  2. Click on 'Edit' (pencil icon) for any monitor
  3. Scroll down to 'tags'
  4. Add a new tag "Tag With Spaces"
  5. click 'Save'

run following python script:

from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import downtimes_api, monitors_api
from datadog_api_client.v1.models import *
import os

configuration = Configuration()
api_client = ApiClient(configuration)
monitor_api = monitors_api.MonitorsApi(api_client)

rv = monitor_api.list_monitors(with_downtimes=True, monitor_tags="Tag With Spaces")
print(len(rv))

Expected behavior list_monitors() returns least one monitor that matches the tag

Environment and Versions (please complete the following information): Python 3.11.4 datadog-api-client==2.17.0

There is nothing in API documentation or UI to suggest that tags with spaces are not supported.

chris-kiick-sp avatar Oct 05 '23 22:10 chris-kiick-sp

Hi,

Indeed the list API doesn't seem to support tags with space. Overall spaces in tags are somewhat discouraged, but I agree with you they are not forbidden. I reached out to the monitor team to see if they can fix this. Thanks for you patience.

therve avatar Oct 06 '23 07:10 therve

Thanks for your contribution!

This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.

If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of this project.

  2. Comment that the issue is still reproducible and include updated details requested in the issue template.

github-actions[bot] avatar Nov 06 '23 00:11 github-actions[bot]