`SoftwareCatalogApi.list_catalog_entity` does not filter services when `filter_name` is passed
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- openapi, python
- Lĩnh vực
- api, backend-api-design
Hướng nghiên cứu
Bắt đầu tại điểm đầu vào SoftwareCatalogApi.list_catalog_entity và tái hiện yêu cầu với filter_name="service:<app_name>" và filter_kind="service". Theo dõi cách bộ lọc được gửi đi và xác minh phản hồi với dịch vụ mong đợi; hoàn thành khi API trả về dịch vụ được yêu cầu khi filter_name được cung cấp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 166
- Fork
- 55
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 73
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DataDog/datadog-api-client-python
-
stale
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
DataDog/datadog-api-client-python#3535 · 1 bình luận ·
-
kind/bug stale
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 66/100
DataDog/datadog-api-client-python#3717 · 3 bình luận ·
-
kind/bug stale
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 75/100
DataDog/datadog-api-client-python#3656 · 1 bình luận ·
-
kind/bug stale
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
DataDog/datadog-api-client-python#3120 · 1 bình luận ·
-
stale
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
DataDog/datadog-api-client-python#2986 · 1 bình luận ·
Tất cả issue của DataDog/datadog-api-client-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/skills#1811 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
speaches-ai/speaches#678 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
datalayer/mcp-compose#42 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
conda-forge/spacy-feedstock#177 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
UKGovernmentBEIS/inspect_evals#2523 ·