From f9e6a8865ff14815d51d72a948cd9c5900dfa5b1 Mon Sep 17 00:00:00 2001 From: Oleksii Moskalenko Date: Thu, 21 Jan 2021 16:19:13 +0800 Subject: [PATCH] counter -> gauge (#1280) Signed-off-by: Oleksii Moskalenko --- sdk/python/feast/contrib/validation/ge.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/sdk/python/feast/contrib/validation/ge.py b/sdk/python/feast/contrib/validation/ge.py index de08a82431..1315d4a59e 100644 --- a/sdk/python/feast/contrib/validation/ge.py +++ b/sdk/python/feast/contrib/validation/ge.py @@ -106,9 +106,6 @@ def udf(df: pd.DataFrame) -> pd.Series: valid_rows = pd.Series([True] * df.shape[0]) for check in result.results: - if check.success: - continue - if check.exception_info["raised_exception"]: # ToDo: probably we should mark all rows as invalid continue @@ -124,7 +121,10 @@ def udf(df: pd.DataFrame) -> pd.Series: ] ) - if "unexpected_count" in check.result: + if ( + "unexpected_count" in check.result + and check.result["unexpected_count"] > 0 + ): reporter.increment( "feast_feature_validation_check_failed", value=check.result["unexpected_count"], @@ -137,12 +137,15 @@ def udf(df: pd.DataFrame) -> pd.Series: valid_rows.iloc[check.result["unexpected_index_list"]] = False - elif "observed_value" in check.result: - reporter.increment( + elif "observed_value" in check.result and check.result["observed_value"]: + reporter.gauge( "feast_feature_validation_observed_value", value=int( - check.result["observed_value"] * 100 - ), # storing as decimal with precision 2 + check.result["observed_value"] + * 100 # storing as decimal with precision 2 + ) + if not check.success + else 0, # nullify everything below threshold tags=[ f"feature_table:{os.getenv('FEAST_INGESTION_FEATURE_TABLE', 'unknown')}", f"project:{os.getenv('FEAST_INGESTION_PROJECT_NAME', 'default')}",