Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion sdk/python/feast/api/registry/rest/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,43 @@ def count_resources_for_project(project_name: str):
"featureViews": 0,
"featureServices": 0,
}

last_updated_ts = None

for project_name in all_projects:
counts = count_resources_for_project(project_name)
all_counts[project_name] = counts

for k in total_counts:
total_counts[k] += counts[k]
return {"total": total_counts, "perProject": all_counts}

try:
feature_views = grpc_call(
grpc_handler.ListAllFeatureViews,
RegistryServer_pb2.ListAllFeatureViewsRequest(
project=project_name,
allow_cache=allow_cache,
),
)
except Exception:
feature_views = {"featureViews": []}

for any_fv in feature_views.get("featureViews", []):
for _, value in any_fv.items():
if isinstance(value, dict):
meta = value.get("meta", {})
ts = meta.get("lastUpdatedTimestamp")

if ts:
if last_updated_ts is None or ts > last_updated_ts:
last_updated_ts = ts
break
return {
"totalProjects": len(all_projects),
"lastUpdatedTimestamp": last_updated_ts,
"total": total_counts,
"perProject": all_counts,
}

@router.get(
"/metrics/popular_tags", tags=["Metrics"], response_model=PopularTagsResponse
Expand Down
Loading