Repository navigation
feat: Add opt-in feature_service label to feature server request metrics - #7218
rahulremany wants to merge 1 commit into
Conversation
Label feast_feature_server_request_total and feast_feature_server_request_latency_seconds with the feature service a /get-online-features request was made through, gated by a new MetricsConfig.feature_service_label flag (default off) to keep histogram cardinality bounded. Closes feast-dev#6639 Signed-off-by: Rahul Remany <rahulremany@gmail.com>
There was a problem hiding this comment.
Devin Review found 1 potential issue.
3 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| if feature_service_label: | ||
| metrics_ctx.feature_service = request.feature_service or "" |
There was a problem hiding this comment.
🟨 Client spellings inflate metrics cardinality
With labeling enabled, get_online_features uses the submitted name rather than the resolved name. An uncached MySQL registry with a case-insensitive collation accepts different spellings for the same service. An authorized caller can create separate counter and histogram series for that one service.
Was this helpful? React with 👍 or 👎 to provide feedback.
franciscojavierarceo
left a comment
There was a problem hiding this comment.
we need to address the existing client-spelling cardinality finding before merging. _get_features already returns the resolved FeatureService, but the metric uses request.feature_service. with cache_mode='none' and a MySQL case-insensitive collation, multiple submitted spellings resolve to that one object and create separate histogram series. we should label with the resolved object's canonical name and cover alternate spellings without creating extra series.
What this PR does / why we need it:
Requests to
/get-online-featuresare often made through a named feature service, but the feature server's request metrics only break down byendpoint,feature_countandfeature_view_count. That makes it impossible to see latency or error rate per feature service.This adds a
feature_servicelabel tofeast_feature_server_request_totalandfeast_feature_server_request_latency_seconds, behind a new opt-in flag:""._get_featuressucceeds, so a request naming an unknown service (404) can't mint new series from client input."".feature_count_binspattern: the handler reads the flag fromMetricsConfigand sets it on theRequestMetricsContext.Left for follow-ups (both marked optional in the issue): an allowlist of feature service names, and a
feature_servicelabel ononline_features_status_total.Note for dashboards: existing series gain an empty
feature_servicelabel. Queries that aggregate withsum by (...)are unaffected.Which issue(s) this PR fixes:
Fixes #6639
Checks
git commit -s)Testing Strategy
Added
test_feature_service_label(enabled/disabled) covering the/get-online-featureshandler end to end; existing label lookups intest_metrics.pyupdated for the new label.tests/unit/test_metrics.py,tests/unit/test_feature_server.pyandtests/unit/infra/feature_serverspass (206 tests); ruff and mypy clean.Misc
Docs updated in
docs/reference/feature-servers/python-feature-server.md.