`SoftwareCatalogApi.list_catalog_entity` does not filter services when `filter_name` is passed
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- openapi, python
調査の方向性
SoftwareCatalogApi.list_catalog_entity エントリポイントから開始し、filter_name="service:<app_name>" と filter_kind="service" を指定してリクエストを再現します。フィルターがどのように送信されるかを追跡し、期待されるサービスと照合してレスポンスを検証します。filter_name を指定したときに API が要求されたサービスを返せば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 166
- フォーク
- 55
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 73
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DataDog/datadog-api-client-python のほかの issue
-
stale
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
DataDog/datadog-api-client-python#3535 · コメント 1 件 ·
-
kind/bug stale
難易度 3/5 1〜2日 初心者へのやさしさ 66/100
DataDog/datadog-api-client-python#3717 · コメント 3 件 ·
-
kind/bug stale
難易度 3/5 1〜2日 初心者へのやさしさ 75/100
DataDog/datadog-api-client-python#3656 · コメント 1 件 ·
-
kind/bug stale
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
DataDog/datadog-api-client-python#3120 · コメント 1 件 ·
-
stale
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
DataDog/datadog-api-client-python#2986 · コメント 1 件 ·
DataDog/datadog-api-client-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
anthropics/skills#1811 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
speaches-ai/speaches#678 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
datalayer/mcp-compose#42 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
conda-forge/spacy-feedstock#177 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
UKGovernmentBEIS/inspect_evals#2523 ·