`SoftwareCatalogApi.list_catalog_entity` does not filter services when `filter_name` is passed
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 38/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- openapi, python
- Ambito
- api, backend-api-design
Direzione di ricerca
Parti dal punto di ingresso SoftwareCatalogApi.list_catalog_entity e riproduci la richiesta con filter_name="service:<app_name>" e filter_kind="service". Traccia come viene inviato il filtro e verifica la risposta rispetto al servizio previsto; il lavoro è completato quando l'API restituisce il servizio richiesto se viene fornito filter_name.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
documentationlabel 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
- Lingua principale
- Python
- Stelle
- 166
- Fork
- 55
- Merge medio
- 2g 17h
- PR unite (30g)
- 73
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di DataDog/datadog-api-client-python
-
stale
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
DataDog/datadog-api-client-python#3535 · 1 commento ·
-
kind/bug stale
Difficoltà 3/5 1-2 giorni Idoneità per principianti 66/100
DataDog/datadog-api-client-python#3717 · 3 commenti ·
-
kind/bug stale
Difficoltà 3/5 1-2 giorni Idoneità per principianti 75/100
DataDog/datadog-api-client-python#3656 · 1 commento ·
-
kind/bug stale
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
DataDog/datadog-api-client-python#3120 · 1 commento ·
-
stale
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
DataDog/datadog-api-client-python#2986 · 1 commento ·
Tutte le issue di DataDog/datadog-api-client-python
Issue simili
-
essnmx good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
[Feature] 奇物选择添加优先级 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Giskard-AI/giskard-oss#2840 · 1 commento ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Apertaarea: repo bug perceived difficulty: 2
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
yeti-platform/yeti#1380 ·