Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`SoftwareCatalogApi.list_catalog_entity` does not filter services when `filter_name` is passed

Open
#2,756 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
openapi, python

Research direction

Start at the SoftwareCatalogApi.list_catalog_entity entry point and reproduce the request with filter_name="service:<app_name>" and filter_kind="service". Trace how the filter is sent and verify the response against the expected service; done means the API returns the requested service when filter_name is provided.

Written by the indexing model from the issue text.

Description

kind/bug stale

Describe the bug
I have tried to pass in variations of filter_name such as filter_name=app_name, filter_name=f"name:{app_name}", and filter_name=f"service:{app_name}". The results always return the services in alphabetical order. I have verified the services I'm filtering exist.

Label the issue properly.

  • Add severity/ label.
  • Add documentation label if this issue is related to documentation changes.

To Reproduce
Steps to reproduce the behavior:

def associate_datadog_teams(app_name: str, owner: str) -> str:
    if not app_name or not isinstance(app_name, str):
        raise ValueError("Invalid app_name provided")
    if not owner or not isinstance(owner, str):
        raise ValueError("Invalid owner provided")

    # Make sure application key is available under the env var the SDK expects
    if os.getenv("DD_APP_KEY") is None and os.getenv("DD_APPLICATION_KEY"):
        os.environ["DD_APP_KEY"] = os.environ["DD_APPLICATION_KEY"]

    # Validate required credentials are present
    if not os.getenv("DD_API_KEY") or not os.getenv("DD_APP_KEY"):
        raise ValueError(
            "Missing Datadog credentials. Ensure DD_API_KEY and DD_APP_KEY (or DD_APPLICATION_KEY) are set."
        )

    # Helper for safely getting nested attributes whether SDK returns models or dicts
    def _get(obj, path: list[str], default=None):
        cur = obj
        for key in path:
            if cur is None:
                return default
            if isinstance(cur, dict):
                cur = cur.get(key)
            else:
                cur = getattr(cur, key, None)
        return cur if cur is not None else default

    # Search for service by exact name
    configuration = Configuration()
    with ApiClient(configuration) as api_client:
        api = SoftwareCatalogApi(api_client)
        try:
            resp = api.list_catalog_entity(filter_name=f"service:{app_name}", filter_kind="service", page_limit=5)
        except Exception as e:
            raise ValueError(f"Failed to query Datadog Software Catalog: {e}") from e
        
        print("Services returned by API:")
        for item in resp.data:
            service_name = item.attributes.name
            print(f"  - {service_name}")
        print()

        items = _get(resp, ["data"], [])
        # Find an exact name match among returned items
        matched = None
        for it in items or []:
            name = _get(it, ["attributes", "name"]) or _get(it, ["attributes", "metadata", "name"])  # fallback
            if name == app_name:
                matched = it
                break

        if not matched:
            return f"Service '{app_name}' not found in Datadog Service Catalog. Skipping association."

Expected behavior

It should return the service I'm passing as filter_name.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment and Versions (please complete the following information):
A clear and precise description of your setup:
datadog_api_client==2.40.0

Dominant language
Python
Stars
166
Forks
55
Avg merge
2d 17h
Merged PRs (30d)
73

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DataDog/datadog-api-client-python

All issues in DataDog/datadog-api-client-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.