Compute metrics from feature serving logs for a feature service.
(request: ComputeLogMetricsRequest)
| 168 | |
| 169 | @router.post("/monitoring/compute/log", tags=["Monitoring"]) |
| 170 | async def compute_log_metrics(request: ComputeLogMetricsRequest): |
| 171 | """Compute metrics from feature serving logs for a feature service.""" |
| 172 | if request.granularity not in VALID_GRANULARITIES: |
| 173 | raise HTTPException( |
| 174 | status_code=400, |
| 175 | detail=f"Invalid granularity '{request.granularity}'. " |
| 176 | f"Must be one of {VALID_GRANULARITIES}", |
| 177 | ) |
| 178 | |
| 179 | store = _get_store() |
| 180 | fs = store.registry.get_feature_service( |
| 181 | name=request.feature_service_name, project=request.project |
| 182 | ) |
| 183 | assert_permissions(fs, actions=[AuthzedAction.UPDATE]) |
| 184 | |
| 185 | svc = _get_monitoring_service() |
| 186 | |
| 187 | start_d = date.fromisoformat(request.start_date) if request.start_date else None |
| 188 | end_d = date.fromisoformat(request.end_date) if request.end_date else None |
| 189 | |
| 190 | try: |
| 191 | result = svc.compute_log_metrics( |
| 192 | project=request.project, |
| 193 | feature_service_name=request.feature_service_name, |
| 194 | start_date=start_d, |
| 195 | end_date=end_d, |
| 196 | granularity=request.granularity, |
| 197 | set_baseline=request.set_baseline, |
| 198 | ) |
| 199 | return result |
| 200 | except Exception as e: |
| 201 | raise HTTPException(status_code=500, detail=str(e)) |
| 202 | |
| 203 | @router.post("/monitoring/auto_compute/log", tags=["Monitoring"]) |
| 204 | async def auto_compute_log(request: AutoComputeLogRequest): |
nothing calls this directly
no test coverage detected