Skip to content

Commit 86810f7

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 3d495a9 + 2adcf2c commit 86810f7

40 files changed

+8989
-8078
lines changed

docs/reference/feature-servers/registry-server.md

Lines changed: 187 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,4 +946,190 @@ Please refer the [page](./../registry/registry-permissions.md) for more details
946946

947947
## How to configure Authentication and Authorization ?
948948

949-
Please refer the [page](./../../../docs/getting-started/concepts/permission.md) for more details on how to configure authentication and authorization.
949+
Please refer the [page](./../../../docs/getting-started/concepts/permission.md) for more details on how to configure authentication and authorization.
950+
951+
### Metrics
952+
953+
#### Get Resource Counts
954+
- **Endpoint**: `GET /api/v1/metrics/resource_counts`
955+
- **Description**: Retrieve counts of registry objects (entities, data sources, feature views, etc.) for a project or across all projects.
956+
- **Parameters**:
957+
- `project` (optional): Project name to filter resource counts (if not provided, returns counts for all projects)
958+
- **Examples**:
959+
```bash
960+
# Get counts for specific project
961+
curl -H "Authorization: Bearer <token>" \
962+
"http://localhost:6572/api/v1/metrics/resource_counts?project=my_project"
963+
964+
# Get counts for all projects
965+
curl -H "Authorization: Bearer <token>" \
966+
"http://localhost:6572/api/v1/metrics/resource_counts"
967+
```
968+
- **Response Example** (single project):
969+
```json
970+
{
971+
"project": "my_project",
972+
"counts": {
973+
"entities": 5,
974+
"dataSources": 3,
975+
"savedDatasets": 2,
976+
"features": 12,
977+
"featureViews": 4,
978+
"featureServices": 2
979+
}
980+
}
981+
```
982+
- **Response Example** (all projects):
983+
```json
984+
{
985+
"total": {
986+
"entities": 15,
987+
"dataSources": 8,
988+
"savedDatasets": 5,
989+
"features": 35,
990+
"featureViews": 12,
991+
"featureServices": 6
992+
},
993+
"perProject": {
994+
"project_a": {
995+
"entities": 5,
996+
"dataSources": 3,
997+
"savedDatasets": 2,
998+
"features": 12,
999+
"featureViews": 4,
1000+
"featureServices": 2
1001+
},
1002+
"project_b": {
1003+
"entities": 10,
1004+
"dataSources": 5,
1005+
"savedDatasets": 3,
1006+
"features": 23,
1007+
"featureViews": 8,
1008+
"featureServices": 4
1009+
}
1010+
}
1011+
}
1012+
```
1013+
1014+
#### Get Recently Visited Objects
1015+
- **Endpoint**: `GET /api/v1/metrics/recently_visited`
1016+
- **Description**: Retrieve the most recently visited registry objects for the authenticated user in a project.
1017+
- **Parameters**:
1018+
- `project` (optional): Project name to filter recent visits (defaults to current project)
1019+
- `object` (optional): Object type to filter recent visits (e.g., entities, features, feature_services)
1020+
- `page` (optional): Page number for pagination (starts from 1)
1021+
- `limit` (optional): Number of items per page (maximum 100)
1022+
- `sort_by` (optional): Field to sort by (e.g., timestamp, path, object)
1023+
- `sort_order` (optional): Sort order: "asc" or "desc" (default: "asc")
1024+
- **Examples**:
1025+
```bash
1026+
# Get all recent visits for a project
1027+
curl -H "Authorization: Bearer <token>" \
1028+
"http://localhost:6572/api/v1/metrics/recently_visited?project=my_project"
1029+
1030+
# Get recent visits with pagination
1031+
curl -H "Authorization: Bearer <token>" \
1032+
"http://localhost:6572/api/v1/metrics/recently_visited?project=my_project&page=1&limit=10"
1033+
1034+
# Get recent visits filtered by object type
1035+
curl -H "Authorization: Bearer <token>" \
1036+
"http://localhost:6572/api/v1/metrics/recently_visited?project=my_project&object=entities"
1037+
1038+
# Get recent visits sorted by timestamp descending
1039+
curl -H "Authorization: Bearer <token>" \
1040+
"http://localhost:6572/api/v1/metrics/recently_visited?project=my_project&sort_by=timestamp&sort_order=desc"
1041+
```
1042+
- **Response Example** (without pagination):
1043+
```json
1044+
{
1045+
"visits": [
1046+
{
1047+
"path": "/api/v1/entities/driver",
1048+
"timestamp": "2024-07-18T12:34:56.789Z",
1049+
"project": "my_project",
1050+
"user": "alice",
1051+
"object": "entities",
1052+
"object_name": "driver",
1053+
"method": "GET"
1054+
},
1055+
{
1056+
"path": "/api/v1/feature_services/user_service",
1057+
"timestamp": "2024-07-18T12:30:45.123Z",
1058+
"project": "my_project",
1059+
"user": "alice",
1060+
"object": "feature_services",
1061+
"object_name": "user_service",
1062+
"method": "GET"
1063+
}
1064+
],
1065+
"pagination": {
1066+
"totalCount": 2
1067+
}
1068+
}
1069+
```
1070+
- **Response Example** (with pagination):
1071+
```json
1072+
{
1073+
"visits": [
1074+
{
1075+
"path": "/api/v1/entities/driver",
1076+
"timestamp": "2024-07-18T12:34:56.789Z",
1077+
"project": "my_project",
1078+
"user": "alice",
1079+
"object": "entities",
1080+
"object_name": "driver",
1081+
"method": "GET"
1082+
}
1083+
],
1084+
"pagination": {
1085+
"page": 1,
1086+
"limit": 10,
1087+
"totalCount": 25,
1088+
"totalPages": 3,
1089+
"hasNext": true,
1090+
"hasPrevious": false
1091+
}
1092+
}
1093+
```
1094+
1095+
**Note**: Recent visits are automatically logged when users access registry objects via the REST API. The logging behavior can be configured through the `feature_server.recent_visit_logging` section in `feature_store.yaml` (see configuration section below).
1096+
1097+
---
1098+
1099+
## Registry Server Configuration: Recent Visit Logging
1100+
1101+
The registry server supports configuration of recent visit logging via the `feature_server` section in `feature_store.yaml`.
1102+
1103+
**Example:**
1104+
```yaml
1105+
feature_server:
1106+
type: local
1107+
recent_visit_logging:
1108+
limit: 100 # Number of recent visits to store per user
1109+
log_patterns:
1110+
- ".*/entities/(?!all$)[^/]+$"
1111+
- ".*/data_sources/(?!all$)[^/]+$"
1112+
- ".*/feature_views/(?!all$)[^/]+$"
1113+
- ".*/features/(?!all$)[^/]+$"
1114+
- ".*/feature_services/(?!all$)[^/]+$"
1115+
- ".*/saved_datasets/(?!all$)[^/]+$"
1116+
- ".*/custom_api/.*"
1117+
```
1118+
1119+
**Configuration Options:**
1120+
- **recent_visit_logging.limit**: Maximum number of recent visits to store per user (default: 100).
1121+
- **recent_visit_logging.log_patterns**: List of regex patterns for API paths to log as recent visits.
1122+
1123+
**Default Log Patterns:**
1124+
- `.*/entities/(?!all$)[^/]+$` - Individual entity endpoints
1125+
- `.*/data_sources/(?!all$)[^/]+$` - Individual data source endpoints
1126+
- `.*/feature_views/(?!all$)[^/]+$` - Individual feature view endpoints
1127+
- `.*/features/(?!all$)[^/]+$` - Individual feature endpoints
1128+
- `.*/feature_services/(?!all$)[^/]+$` - Individual feature service endpoints
1129+
- `.*/saved_datasets/(?!all$)[^/]+$` - Individual saved dataset endpoints
1130+
1131+
**Behavior:**
1132+
- Only requests matching one of the `log_patterns` will be tracked
1133+
- Only the most recent `limit` visits per user are stored
1134+
- Metrics endpoints (`/metrics/*`) are automatically excluded from logging to prevent circular references
1135+
- Visit data is stored per user and per project in the registry metadata

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ dependencies = [
4343
"psutil",
4444
"bigtree>=0.19.2",
4545
"pyjwt",
46-
"transformers>=4.36.0",
4746
]
4847

4948
[project.optional-dependencies]
@@ -109,6 +108,7 @@ postgres-c = ["psycopg[c,pool]==3.2.5"]
109108
pytorch = ["torch>=2.7.0", "torchvision>=0.22.1"]
110109
qdrant = ["qdrant-client>=1.12.0"]
111110
rag = [
111+
"transformers>=4.36.0",
112112
"datasets>=3.6.0",
113113
]
114114
redis = [

sdk/python/feast/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from .field import Field
2020
from .on_demand_feature_view import OnDemandFeatureView
2121
from .project import Project
22-
from .rag_retriever import FeastIndex, FeastRAGRetriever
2322
from .repo_config import RepoConfig
2423
from .stream_feature_view import StreamFeatureView
2524
from .value_type import ValueType
@@ -53,7 +52,5 @@
5352
"RequestSource",
5453
"AthenaSource",
5554
"Project",
56-
"FeastIndex",
57-
"FeastRAGRetriever",
5855
"FeastVectorStore",
5956
]

sdk/python/feast/api/registry/rest/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
from feast.api.registry.rest.feature_views import get_feature_view_router
77
from feast.api.registry.rest.features import get_feature_router
88
from feast.api.registry.rest.lineage import get_lineage_router
9+
from feast.api.registry.rest.metrics import get_metrics_router
910
from feast.api.registry.rest.permissions import get_permission_router
1011
from feast.api.registry.rest.projects import get_project_router
1112
from feast.api.registry.rest.saved_datasets import get_saved_dataset_router
1213

1314

14-
def register_all_routes(app: FastAPI, grpc_handler):
15+
def register_all_routes(app: FastAPI, grpc_handler, server=None):
1516
app.include_router(get_entity_router(grpc_handler))
1617
app.include_router(get_data_source_router(grpc_handler))
1718
app.include_router(get_feature_service_router(grpc_handler))
@@ -21,3 +22,4 @@ def register_all_routes(app: FastAPI, grpc_handler):
2122
app.include_router(get_permission_router(grpc_handler))
2223
app.include_router(get_project_router(grpc_handler))
2324
app.include_router(get_saved_dataset_router(grpc_handler))
25+
app.include_router(get_metrics_router(grpc_handler, server))

0 commit comments

Comments
 (0)