@@ -109,11 +109,9 @@ def udf(df: pd.DataFrame) -> pd.Series:
109109 if check .success :
110110 continue
111111
112- unexpected_count = (
113- check .result ["unexpected_count" ]
114- if "unexpected_count" in check .result
115- else df .shape [0 ]
116- )
112+ if check .exception_info ["raised_exception" ]:
113+ # ToDo: probably we should mark all rows as invalid
114+ continue
117115
118116 check_kwargs = check .expectation_config .kwargs
119117 check_kwargs .pop ("result_format" , None )
@@ -126,21 +124,31 @@ def udf(df: pd.DataFrame) -> pd.Series:
126124 ]
127125 )
128126
129- reporter .increment (
130- "feast_feature_validation_check_failed" ,
131- value = unexpected_count ,
132- tags = [
133- f"feature_table:{ os .getenv ('FEAST_INGESTION_FEATURE_TABLE' , 'unknown' )} " ,
134- f"project:{ os .getenv ('FEAST_INGESTION_PROJECT_NAME' , 'default' )} " ,
135- f"check:{ check_name } " ,
136- ],
137- )
138-
139- if check .exception_info ["raised_exception" ]:
140- # ToDo: probably we should mark all rows as invalid
141- continue
127+ if "unexpected_count" in check .result :
128+ reporter .increment (
129+ "feast_feature_validation_check_failed" ,
130+ value = check .result ["unexpected_count" ],
131+ tags = [
132+ f"feature_table:{ os .getenv ('FEAST_INGESTION_FEATURE_TABLE' , 'unknown' )} " ,
133+ f"project:{ os .getenv ('FEAST_INGESTION_PROJECT_NAME' , 'default' )} " ,
134+ f"check:{ check_name } " ,
135+ ],
136+ )
142137
143- valid_rows .iloc [check .result ["unexpected_index_list" ]] = False
138+ valid_rows .iloc [check .result ["unexpected_index_list" ]] = False
139+
140+ elif "observed_value" in check .result :
141+ reporter .increment (
142+ "feast_feature_validation_observed_value" ,
143+ value = int (
144+ check .result ["observed_value" ] * 100
145+ ), # storing as decimal with precision 2
146+ tags = [
147+ f"feature_table:{ os .getenv ('FEAST_INGESTION_FEATURE_TABLE' , 'unknown' )} " ,
148+ f"project:{ os .getenv ('FEAST_INGESTION_PROJECT_NAME' , 'default' )} " ,
149+ f"check:{ check_name } " ,
150+ ],
151+ )
144152
145153 return valid_rows
146154
0 commit comments