Skip to content

Monitor list filtering by tags is not returning data #2063

Description

@martinezcoder

Describe the bug

Calling the list monitors method with options to filter by tags is not working. It returns an empty list. I have a couple of monitors with the "my-tag" tag, and I have already checked that these monitors are returned if I don't use filters, including the one with the tag.

To Reproduce
Steps to reproduce the behavior:

  1. Add the tag "my-tag" to a couple of monitors
  2. Call the API to list these monitors
DatadogAPIClient::V1::MonitorsAPI.new(@client).list_monitors({ tags: "my-tag"})
  1. Debug the DatadogAPIClient::V1::MonitorsAPI request.

Debugging the code at datadog_api_client-2.27.1/lib/datadog_api_client/v1/api/monitors_api.rb:557 shows that the information sent to the API is correct:

{
  :tags=>"my-tag",
  :operation=>:list_monitors, 
  :header_params=>{"Accept"=>"application/json"}, 
  :query_params=> {
    :tags=>"my-tag"
  }, 
  :form_params=>{}, 
  :body=>nil, 
  :auth_names=>[:apiKeyAuth, :appKeyAuth, :AuthZ], 
  :return_type=>"Array<Monitor>", 
  :api_version=>"V1"
}

However, it returns an empty list:

[7] pry(#<DatadogAPIClient::V1::MonitorsAPI>)> @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
=> [[],
 200,
 {"date"=>["Thu, 17 Oct 2024 09:02:16 GMT"],
  "content-type"=>["application/json"],
  "content-length"=>["3"],
  "etag"=>["..."],
  "x-frame-options"=>["SAMEORIGIN"],
  "content-security-policy"=>["..."],
  "x-ratelimit-limit"=>["1000"],
  "x-ratelimit-period"=>["10"],
  "x-ratelimit-remaining"=>["999"],
  "x-ratelimit-reset"=>["4"],
  "x-ratelimit-name"=>["get_all_monitors"],
  "x-content-type-options"=>["nosniff"],
  "strict-transport-security"=>["max-age=31536000; includeSubDomains; preload"],
  "via"=>["1.1 google"],
  "alt-svc"=>["h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000"],
  "connection"=>["close"]}]

Expected behavior
It returns the list of monitors with the mentioned tag.

Screenshots
n/a

Environment and Versions (please complete the following information):

  • ruby version 3.3.5
  • gem version datadog_api_client-2.27.1
  • gem service DatadogAPIClient::V1::MonitorsAPI

Additional context

The seems to be in the API itself https://api.datadoghq.eu/api/v1/monitor or maybe the query parameter to filter tags has a different name.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions