feat: Make feature-count latency histogram bins configurable
- Dominant language
- Python
- Stars
- 7.3k
- Forks
- 1.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 15
Description
Follow-up from #5920 (Improve Feature Server Observability).
**Problem**
`request_latency` in `sdk/python/feast/metrics.py` is labeled with `feature_count` using the **raw count** of features requested (see `track_request_latency` / `RequestMetricsContext.feature_count`). Raw counts create unbounded label cardinality — every distinct feature count seen in production becomes its own time series. The issue asks for configurable bins instead, e.g. `1-10`, `11-50`, `51-200`, `201+`.
**Proposed solution**
- Add a binning function (e.g. `bin_feature_count(count: int, bins: list[int]) -> str`) that maps a raw feature count to a bin label like `"1-10"`, `"11-50"`, `"51-200"`, `"201+"`.
- Default bins should match the issue's suggestion (`1-10, 11-50, 51-200, 201+`) but should be configurable via `MetricsConfig` in `feature_store.yaml` (e.g. `metrics.feature_count_bins: [10, 50, 200]`).
- Apply this wherever `feature_count` is currently set as a raw value before being passed into `RequestMetricsContext` in `sdk/python/feast/feature_server.py`.
- Same treatment could apply to `feature_view_count`.
- Update relevant docs (`docs/getting-started/components/feature-server.md` or wherever metrics config is documented) to describe the new config option.
cc: @jyejare @ntkathole
Contributor guide
Research direction
Start with sdk/python/feast/metrics.py and sdk/python/feast/feature_server.py, tracing RequestMetricsContext.feature_count and track_request_latency. Review MetricsConfig and the feature-server documentation to determine how feature_count_bins should be exposed; done means configurable bounded bin labels are used, with the suggested defaults documented and feature_view_count addressed if applicable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100