MCPcopy Index your code
hub / github.com/feast-dev/feast / compute_log_metrics

Function compute_log_metrics

sdk/python/feast/api/registry/rest/monitoring.py:170–201  ·  view source on GitHub ↗

Compute metrics from feature serving logs for a feature service.

(request: ComputeLogMetricsRequest)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 5

assert_permissionsFunction · 0.90
_get_storeFunction · 0.85
_get_monitoring_serviceFunction · 0.85
compute_log_metricsMethod · 0.80
get_feature_serviceMethod · 0.45

Tested by

no test coverage detected