Sitelet https://github.com/feast-dev/feast/pull/6782
Skip to content

fix: Exclude non-finite values from numeric monitoring metrics - #6782

Open
piyush182004 wants to merge 1 commit into
feast-dev:masterfrom
piyush182004:fix/monitoring-metrics-nonfinite
Open

fix: Exclude non-finite values from numeric monitoring metrics#6782
piyush182004 wants to merge 1 commit into
feast-dev:masterfrom
piyush182004:fix/monitoring-metrics-nonfinite

Conversation

@piyush182004

@piyush182004 piyush182004 commented Aug 25, 2026

Copy link
Copy Markdown

ISSUE FIX:- #6783

What this PR does / why we need it:

MetricsCalculator.compute_numeric() passed values straight to
np.histogram(), which raises on NaN/+-Inf:

ValueError: autodetected range of [0.05, inf] is not finite

Non-finite values arise from ordinary feature engineering - a
click-through rate whose denominator is zero, a log of zero, or missing
values encoded as NaN. compute_all() has no per-column error handling,
so a single such value discarded the metrics for the entire feature view,
including columns that were perfectly well-formed.

The failure was silent from the caller's perspective: the monitoring API
still returned HTTP 200 with "status": "completed" and
"computed_features": 0, so the UI showed no error - the feature view was
simply absent from the Monitoring page.

This PR filters non-finite values once, after nulls are dropped, so every
statistic is computed over finite data, and applies the existing
_safe_float/opt_float helpers to min_val, max_val and the
quantiles (previously only mean and stddev were guarded, letting Inf
leak into stored metrics). row_count/null_count continue to describe
the raw data.

The same unguarded np.histogram call is duplicated in the Dask offline
store's _dask_compute_numeric_metrics, and is fixed there too.

Verification

Before: a feature view containing one inf value produced zero metrics
for all of its features. After: full metrics are produced, computed
correctly over the finite values (verified against an identical feature
view with no inf, which behaved correctly on both sides).

Full unit suite: 315 passed, 24 skipped. 6 new regression tests added.

Which issue(s) this PR fixes:

Fixes #<ISSUE_NUMBER>

Checks

  • I've made sure the tests are passing.
  • My commits are signed off (git commit -s)
  • My PR title follows conventional commits format

Testing Strategy

  • Unit tests

compute_numeric() passed its values straight to np.histogram, which raises
on NaN/+-Inf:

    ValueError: autodetected range of [0.05, inf] is not finite

Non-finite values arise from ordinary feature engineering - a click-through
rate whose denominator is zero, a log of zero, or missing values encoded as
NaN. compute_all() has no per-column error handling, so a single such value
discarded the metrics for the entire feature view, including columns that
were perfectly well-formed.

The failure was silent from the caller's perspective: the monitoring API
still returned HTTP 200 with status "completed" and computed_features 0, so
the UI showed no error - the feature view was simply absent from the
Monitoring page.

Filter non-finite values once, after nulls are dropped, so every statistic
is computed over finite data, and apply the existing _safe_float/opt_float
helpers to min_val, max_val and the quantiles (previously only mean and
stddev were guarded, letting Inf leak into the stored metrics).
row_count/null_count continue to describe the raw data.

The same unguarded np.histogram call is duplicated in the Dask offline
store's _dask_compute_numeric_metrics, and is fixed there too.

Signed-off-by: Piyush Mondal <piyushmondal182004@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant