Visitar URL original
feat: Add feature_service label to Feature Server RED metrics · Issue #6639 · feast-dev/feast · GitHub
Skip to content

feat: Add feature_service label to Feature Server RED metrics #6639

Description

@anshishrivastava

Follow-up from #5920 (Improve Feature Server Observability).

Problem

sdk/python/feast/metrics.py currently breaks out online-feature metrics by feature_view (see online_features_status_total's feature_view label in track_feature_statuses), but there is no equivalent feature_service label anywhere in the metrics, even though requests to /get-online-features are frequently made via a named Feature Service.

Proposed solution

  • Add a feature_service label to the relevant RED metrics (at minimum request_latency/request_count in the track_request_latency context, and consider online_features_status_total).
  • Resolve the feature service name in the /get-online-features handler in sdk/python/feast/feature_server.py (available from the parsed request body) and pass it through via RequestMetricsContext, following the existing pattern used for feature_count/feature_view_count.
  • Add cardinality safeguards per the original issue: make this label opt-in (config flag, default off) and/or support an allowlist of feature service names, since unbounded feature-service cardinality could blow up metric storage in large deployments.
  • Wire the new config flag into MetricsConfig / _MetricsFlags alongside the existing per-category toggles.

cc: @jyejare @ntkathole

Activity

  1. saket3395 commented on Aug 14, 2026

    @saket3395
    Contributor

    @jyejare @ntkathole I'd like to pick this up (following on from #6709). I read through metrics.py / feature_server.py and the existing feature_count/feature_view_count plumbing, and the pieces line up nicely — GetOnlineFeaturesRequest already carries feature_service, and the /get-online-features handler already owns a mutable RequestMetricsContext. Before I write it, I'd like to confirm the design so I build the version you want:

    Proposed implementation (mirrors the existing pattern):

    1. Add feature_service to RequestMetricsContext.__slots__ and to the track_request_latency(...) signature (default ""), exactly like feature_count/feature_view_count.
    2. Add a feature_service label to request_latency (and request_count) — gated so it's only populated when the opt-in flag is on; "" otherwise.
    3. In the /get-online-features handler, set metrics_ctx.feature_service = request.feature_service or "" (the name is already on the parsed request body — no extra lookup needed).
    4. Add an opt-in flag to MetricsConfig + _MetricsFlags (build_metrics_flags), default off, since a per-service label on the request_latency Histogram multiplies series and unbounded service cardinality could hurt large deployments.

    Design questions I'd like your call on before coding:

    • Flag name / shape: a dedicated request_feature_service boolean under MetricsConfig, or a sub-toggle nested under the existing request category? Happy to match whatever convention you prefer.
    • Which metrics get the label: request_latency for sure. Also add it to request_count? And do you want it on online_features_status_total (the track_feature_statuses path) in this same PR, or keep that out of scope for now?
    • Allowlist: the issue mentions an optional feature-service allowlist for cardinality control. I'd suggest shipping the opt-in boolean first (smaller, reviewable PR) and doing the allowlist as a follow-up — unless you'd rather have it in v1.

    Once you confirm the flag shape + metric scope, I'll open a PR with tests. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions