diff --git a/sdk/python/feast/api/registry/rest/monitoring.py b/sdk/python/feast/api/registry/rest/monitoring.py
index 51911493218..e064d5fc4d5 100644
--- a/sdk/python/feast/api/registry/rest/monitoring.py
+++ b/sdk/python/feast/api/registry/rest/monitoring.py
@@ -536,4 +536,56 @@ async def get_timeseries(
)
return filter_rows(rows, allowed_feature_views=allowed_fvs)
+ @router.get("/monitoring/date_buckets", tags=["Monitoring"])
+ async def get_date_buckets(
+ project: str = Query(...),
+ feature_view_name: Optional[str] = Query(None),
+ feature_service_name: Optional[str] = Query(None),
+ granularity: Optional[str] = Query(None),
+ data_source_type: Optional[str] = Query(None),
+ start_date: Optional[str] = Query(None),
+ end_date: Optional[str] = Query(None),
+ ):
+ store = _get_store()
+ with scoped_project(project):
+ _authz_read_feature_views(
+ store, project, feature_view_name, feature_service_name
+ )
+
+ svc = _get_monitoring_service()
+ return svc.get_date_buckets(
+ project=project,
+ feature_view_name=feature_view_name,
+ feature_service_name=feature_service_name,
+ granularity=granularity,
+ data_source_type=data_source_type,
+ start_date=date.fromisoformat(start_date) if start_date else None,
+ end_date=date.fromisoformat(end_date) if end_date else None,
+ )
+
+ @router.get("/monitoring/profiles", tags=["Monitoring"])
+ async def get_profiles(
+ project: str = Query(...),
+ feature_view_name: str = Query(...),
+ feature_name: Optional[str] = Query(None),
+ granularity: Optional[str] = Query(None),
+ start_date: Optional[str] = Query(None),
+ end_date: Optional[str] = Query(None),
+ ):
+ store = _get_store()
+ with scoped_project(project):
+ assert_feature_view(
+ store, project, feature_view_name, AuthzedAction.DESCRIBE
+ )
+
+ svc = _get_monitoring_service()
+ return svc.get_profiles(
+ project=project,
+ feature_view_name=feature_view_name,
+ feature_name=feature_name,
+ granularity=granularity,
+ start_date=date.fromisoformat(start_date) if start_date else None,
+ end_date=date.fromisoformat(end_date) if end_date else None,
+ )
+
return router
diff --git a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py
index be06dea14ee..1e9d4d7f16e 100644
--- a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py
+++ b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon.py
@@ -1,7 +1,9 @@
+import json
+import os
import posixpath
-from datetime import datetime
+from datetime import date, datetime, timezone
from pathlib import Path
-from typing import Any, Callable, List, Literal, Optional, Union
+from typing import Any, Callable, Dict, List, Literal, Optional, Union
import pandas as pd
import pyarrow as pa
@@ -28,6 +30,13 @@
infer_event_timestamp_from_entity_df,
)
from feast.infra.registry.base_registry import BaseRegistry
+from feast.monitoring.monitoring_utils import (
+ MONITORING_DIR,
+ MONITORING_PARQUET_FILES,
+ MONITORING_TIMESTAMP_FIELDS,
+ monitoring_parquet_meta,
+ normalize_monitoring_row,
+)
from feast.on_demand_feature_view import OnDemandFeatureView
from feast.repo_config import FeastConfigBaseModel, RepoConfig
from feast.saved_dataset import SavedDatasetStorage
@@ -502,3 +511,250 @@ def offline_write_batch(
raise NotImplementedError(
"ChrononOfflineStore does not support Feast-managed offline writes."
)
+
+ @staticmethod
+ def ensure_monitoring_tables(config: RepoConfig) -> None:
+ assert isinstance(config.offline_store, ChrononOfflineStoreConfig)
+ base = os.path.join(_chronon_monitoring_base(config), MONITORING_DIR)
+ os.makedirs(base, exist_ok=True)
+
+ tables = [
+ monitoring_parquet_meta(t)
+ for t in ("feature", "feature_view", "feature_service", "job")
+ ]
+ for fname, columns, _ in tables:
+ fpath = _chronon_monitoring_path(config, fname)
+ if not os.path.isfile(fpath):
+ os.makedirs(os.path.dirname(fpath), exist_ok=True)
+ pd.DataFrame(columns=columns).to_parquet(fpath, index=False)
+
+ @staticmethod
+ def save_monitoring_metrics(
+ config: RepoConfig,
+ metric_type: str,
+ metrics: List[Dict[str, Any]],
+ ) -> None:
+ if not metrics:
+ return
+ assert isinstance(config.offline_store, ChrononOfflineStoreConfig)
+
+ fname, columns, pk = _chronon_mon_table_meta(metric_type)
+ path = _chronon_monitoring_path(config, fname)
+ _chronon_parquet_upsert(path, columns, pk, metrics)
+
+ @staticmethod
+ def query_monitoring_metrics(
+ config: RepoConfig,
+ project: str,
+ metric_type: str,
+ filters: Optional[Dict[str, Any]] = None,
+ start_date: Optional[date] = None,
+ end_date: Optional[date] = None,
+ ) -> List[Dict[str, Any]]:
+ assert isinstance(config.offline_store, ChrononOfflineStoreConfig)
+
+ fname, columns, _ = _chronon_mon_table_meta(metric_type)
+ path = _chronon_monitoring_path(config, fname)
+ return _chronon_parquet_query(
+ path, columns, project, filters, start_date, end_date
+ )
+
+ @staticmethod
+ def clear_monitoring_baseline(
+ config: RepoConfig,
+ project: str,
+ feature_view_name: Optional[str] = None,
+ feature_name: Optional[str] = None,
+ data_source_type: Optional[str] = None,
+ ) -> None:
+ assert isinstance(config.offline_store, ChrononOfflineStoreConfig)
+
+ path = _chronon_monitoring_path(config, MONITORING_PARQUET_FILES["feature"])
+ tab = _chronon_read_parquet_if_exists(path)
+ if tab is None or tab.num_rows == 0:
+ return
+
+ df = tab.to_pandas()
+ mask = df["project_id"] == project
+ if feature_view_name is not None and "feature_view_name" in df.columns:
+ mask = mask & (df["feature_view_name"] == feature_view_name)
+ if feature_name is not None and "feature_name" in df.columns:
+ mask = mask & (df["feature_name"] == feature_name)
+ if data_source_type is not None and "data_source_type" in df.columns:
+ mask = mask & (df["data_source_type"] == data_source_type)
+ if "is_baseline" in df.columns:
+ mask = mask & (df["is_baseline"].isin([True, 1]))
+ df.loc[mask, "is_baseline"] = False
+ pq.write_table(pa.Table.from_pandas(df, preserve_index=False), path)
+
+ @staticmethod
+ def get_monitoring_max_timestamp(
+ config: RepoConfig,
+ data_source: DataSource,
+ timestamp_field: str,
+ ) -> Optional[datetime]:
+ if data_source.__class__.__name__ != "ChrononSource":
+ raise NotImplementedError(
+ "ChrononOfflineStore only supports ChrononSource inputs."
+ )
+
+ source: Any = data_source
+ resolved_path = FileSource.get_uri_for_file_path(
+ repo_path=config.repo_path, uri=source.materialization_path
+ )
+ if not Path(resolved_path).exists():
+ return None
+
+ reverse_mapping = {value: key for key, value in source.field_mapping.items()}
+ physical_col = reverse_mapping.get(timestamp_field, timestamp_field)
+
+ try:
+ import pyarrow.compute as pc
+ import pyarrow.dataset as ds
+
+ dataset = ds.dataset(resolved_path, format="parquet", partitioning="hive")
+ if physical_col not in dataset.schema.names:
+ return None
+ table = dataset.to_table(columns=[physical_col])
+ if table.num_rows == 0:
+ return None
+ max_val = pc.max(table.column(physical_col)).as_py()
+ if max_val is None:
+ return None
+ if isinstance(max_val, datetime):
+ return (
+ max_val if max_val.tzinfo else max_val.replace(tzinfo=timezone.utc)
+ )
+ if isinstance(max_val, date):
+ return datetime.combine(
+ max_val, datetime.min.time(), tzinfo=timezone.utc
+ )
+ return None
+ except Exception:
+ return None
+
+
+def _chronon_monitoring_base(config: RepoConfig) -> str:
+ store_path = getattr(config.offline_store, "path", None)
+ if store_path:
+ return str(store_path)
+ base = config.repo_path
+ return str(base) if base else "."
+
+
+def _chronon_monitoring_path(config: RepoConfig, filename: str) -> str:
+ return os.path.join(_chronon_monitoring_base(config), MONITORING_DIR, filename)
+
+
+def _chronon_mon_table_meta(metric_type: str):
+ return monitoring_parquet_meta(metric_type)
+
+
+def _chronon_read_parquet_if_exists(path: str) -> Optional[pa.Table]:
+ if not os.path.isfile(path):
+ return None
+ try:
+ return pq.read_table(path)
+ except Exception:
+ return None
+
+
+def _chronon_parquet_upsert(
+ path: str,
+ columns: List[str],
+ pk_cols: List[str],
+ new_rows: List[Dict[str, Any]],
+) -> None:
+ os.makedirs(os.path.dirname(path), exist_ok=True)
+
+ prepared: List[Dict[str, Any]] = []
+ for row in new_rows:
+ r = dict(row)
+ if (
+ "histogram" in r
+ and r["histogram"] is not None
+ and not isinstance(r["histogram"], str)
+ ):
+ r["histogram"] = json.dumps(r["histogram"])
+ for json_col in ("parameters", "result_summary"):
+ if (
+ json_col in r
+ and r[json_col] is not None
+ and not isinstance(r[json_col], str)
+ ):
+ r[json_col] = json.dumps(r[json_col])
+ prepared.append(r)
+
+ new_df = pd.DataFrame(prepared)
+ for col in columns:
+ if col not in new_df.columns:
+ new_df[col] = None
+ new_df = new_df[columns]
+
+ existing = _chronon_read_parquet_if_exists(path)
+ if existing is not None and existing.num_rows > 0:
+ old_df = existing.to_pandas()
+ for col in columns:
+ if col not in old_df.columns:
+ old_df[col] = None
+ old_df = old_df[columns]
+ if len(old_df) == 0:
+ combined = new_df
+ elif len(new_df) == 0:
+ combined = old_df
+ else:
+ combined = pd.concat([old_df, new_df], ignore_index=True)
+ else:
+ combined = new_df
+
+ combined = combined.drop_duplicates(subset=pk_cols, keep="last")
+ table = pa.Table.from_pandas(combined, preserve_index=False)
+ pq.write_table(table, path)
+
+
+def _chronon_parquet_query(
+ path: str,
+ columns: List[str],
+ project: str,
+ filters: Optional[Dict[str, Any]],
+ start_date: Optional[date],
+ end_date: Optional[date],
+) -> List[Dict[str, Any]]:
+ tab = _chronon_read_parquet_if_exists(path)
+ if tab is None or tab.num_rows == 0:
+ return []
+
+ df = tab.to_pandas()
+ if project and "project_id" in df.columns:
+ df = df[df["project_id"] == project]
+ if filters:
+ for key, value in filters.items():
+ if value is not None and key in df.columns:
+ if key == "is_baseline":
+ df = df[df["is_baseline"].isin([bool(value), int(value)])]
+ else:
+ df = df[df[key] == value]
+ if "metric_date" in df.columns:
+ if start_date is not None:
+ df = df[pd.to_datetime(df["metric_date"]).dt.date >= start_date]
+ if end_date is not None:
+ df = df[pd.to_datetime(df["metric_date"]).dt.date <= end_date]
+ df = df.sort_values("metric_date", ascending=True)
+ elif "job_id" in df.columns:
+ df = df.sort_values("job_id", ascending=True)
+
+ results = []
+ available_cols = [c for c in columns if c in df.columns]
+ for _, row in df.iterrows():
+ record = {c: row.get(c) for c in available_cols}
+ normalize_monitoring_row(record)
+ for key in MONITORING_TIMESTAMP_FIELDS:
+ val = record.get(key)
+ if (
+ val is not None
+ and not isinstance(val, str)
+ and hasattr(val, "isoformat")
+ ):
+ record[key] = val.isoformat()
+ results.append(record)
+ return results
diff --git a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon_source.py b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon_source.py
index 7e9b8229bb3..f039fa2a54c 100644
--- a/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon_source.py
+++ b/sdk/python/feast/infra/offline_stores/contrib/chronon_offline_store/chronon_source.py
@@ -20,11 +20,17 @@ def __init__(
chronon_group_by: Optional[str] = None,
chronon_join: Optional[str] = None,
online_endpoint: Optional[str] = None,
+ output_version: Optional[str] = None,
+ pipeline_run_id: Optional[str] = None,
+ export_timestamp_column: Optional[str] = None,
):
self.materialization_path = materialization_path
self.chronon_group_by = chronon_group_by or ""
self.chronon_join = chronon_join or ""
self.online_endpoint = online_endpoint or ""
+ self.output_version = output_version or ""
+ self.pipeline_run_id = pipeline_run_id or ""
+ self.export_timestamp_column = export_timestamp_column or ""
@classmethod
def from_proto(cls, proto: DataSourceProto.CustomSourceOptions):
@@ -34,6 +40,9 @@ def from_proto(cls, proto: DataSourceProto.CustomSourceOptions):
chronon_group_by=config.get("chronon_group_by"),
chronon_join=config.get("chronon_join"),
online_endpoint=config.get("online_endpoint"),
+ output_version=config.get("output_version"),
+ pipeline_run_id=config.get("pipeline_run_id"),
+ export_timestamp_column=config.get("export_timestamp_column"),
)
def to_proto(self) -> DataSourceProto.CustomSourceOptions:
@@ -44,6 +53,9 @@ def to_proto(self) -> DataSourceProto.CustomSourceOptions:
"chronon_group_by": self.chronon_group_by,
"chronon_join": self.chronon_join,
"online_endpoint": self.online_endpoint,
+ "output_version": self.output_version,
+ "pipeline_run_id": self.pipeline_run_id,
+ "export_timestamp_column": self.export_timestamp_column,
}
).encode()
)
@@ -67,6 +79,9 @@ def __init__(
description: Optional[str] = "",
tags: Optional[Dict[str, str]] = None,
owner: Optional[str] = "",
+ output_version: Optional[str] = None,
+ pipeline_run_id: Optional[str] = None,
+ export_timestamp_column: Optional[str] = None,
):
if not materialization_path:
raise ValueError("ChrononSource requires `materialization_path`.")
@@ -87,6 +102,9 @@ def __init__(
chronon_group_by=chronon_group_by,
chronon_join=chronon_join,
online_endpoint=online_endpoint,
+ output_version=output_version,
+ pipeline_run_id=pipeline_run_id,
+ export_timestamp_column=export_timestamp_column,
)
super().__init__(
@@ -110,6 +128,9 @@ def __eq__(self, other: object) -> bool:
and self.chronon_join == other.chronon_join
and self.chronon_group_by == other.chronon_group_by
and self.online_endpoint == other.online_endpoint
+ and self.output_version == other.output_version
+ and self.pipeline_run_id == other.pipeline_run_id
+ and self.export_timestamp_column == other.export_timestamp_column
)
@property
@@ -128,6 +149,18 @@ def chronon_join(self) -> str:
def online_endpoint(self) -> str:
return self._chronon_options.online_endpoint
+ @property
+ def output_version(self) -> str:
+ return self._chronon_options.output_version
+
+ @property
+ def pipeline_run_id(self) -> str:
+ return self._chronon_options.pipeline_run_id
+
+ @property
+ def export_timestamp_column(self) -> str:
+ return self._chronon_options.export_timestamp_column
+
@staticmethod
def from_proto(data_source: DataSourceProto) -> Any:
assert data_source.HasField("custom_options")
@@ -138,6 +171,9 @@ def from_proto(data_source: DataSourceProto) -> Any:
chronon_group_by=options.chronon_group_by,
chronon_join=options.chronon_join,
online_endpoint=options.online_endpoint,
+ output_version=options.output_version,
+ pipeline_run_id=options.pipeline_run_id,
+ export_timestamp_column=options.export_timestamp_column,
field_mapping=dict(data_source.field_mapping),
timestamp_field=data_source.timestamp_field,
created_timestamp_column=data_source.created_timestamp_column,
diff --git a/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py b/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py
index 3cfc84795fe..f4d5048593d 100644
--- a/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py
+++ b/sdk/python/feast/infra/online_stores/chronon_online_store/chronon.py
@@ -1,4 +1,4 @@
-from datetime import datetime
+from datetime import datetime, timezone
from typing import Any, Callable, Dict, List, Literal, Optional, Tuple
from urllib.parse import quote
@@ -26,6 +26,53 @@ class ChrononOnlineStoreConfig(FeastConfigBaseModel):
connection_retries: StrictInt = Field(default=0, ge=0, le=5)
+def _parse_chronon_timestamp(row: Dict[str, Any]) -> Optional[datetime]:
+ """Extract and parse source freshness timestamp from a Chronon response row.
+
+ Handles milliseconds integer/float, seconds float/int, and ISO strings.
+ Missing or unparseable timestamps return None (treated as unknown).
+ """
+ candidate_keys = (
+ "ts",
+ "timestamp",
+ "event_timestamp",
+ "feature_timestamp",
+ "feature_computation_ts",
+ )
+ raw_val = None
+ for key in candidate_keys:
+ if key in row and row[key] is not None:
+ raw_val = row[key]
+ break
+
+ if raw_val is None:
+ return None
+
+ if isinstance(raw_val, (int, float)):
+ # Chronon timestamps in Java verticle are Unix epoch milliseconds
+ # Values > 1e11 (year 1973 in ms) are milliseconds; smaller are seconds.
+ if raw_val > 1e11:
+ return datetime.fromtimestamp(raw_val / 1000.0, tz=timezone.utc)
+ return datetime.fromtimestamp(float(raw_val), tz=timezone.utc)
+
+ if isinstance(raw_val, str):
+ try:
+ if raw_val.isdigit():
+ val_int = int(raw_val)
+ if val_int > 1e11:
+ return datetime.fromtimestamp(val_int / 1000.0, tz=timezone.utc)
+ return datetime.fromtimestamp(float(val_int), tz=timezone.utc)
+ parsed = datetime.fromisoformat(raw_val.replace("Z", "+00:00"))
+ return parsed if parsed.tzinfo else parsed.replace(tzinfo=timezone.utc)
+ except (ValueError, TypeError):
+ return None
+
+ if isinstance(raw_val, datetime):
+ return raw_val if raw_val.tzinfo else raw_val.replace(tzinfo=timezone.utc)
+
+ return None
+
+
class ChrononOnlineStore(OnlineStore):
@staticmethod
def _get_chronon_source(table: FeatureView):
@@ -161,7 +208,8 @@ def online_read(
feature_values = self._feature_values_to_proto(
features, requested_features, feature_types
)
- output.append((None, feature_values))
+ feature_ts = _parse_chronon_timestamp(row)
+ output.append((feature_ts, feature_values))
return output
def update(
diff --git a/sdk/python/feast/monitoring/metrics_calculator.py b/sdk/python/feast/monitoring/metrics_calculator.py
index 1b8b3b3e7ca..20449b933ea 100644
--- a/sdk/python/feast/monitoring/metrics_calculator.py
+++ b/sdk/python/feast/monitoring/metrics_calculator.py
@@ -107,16 +107,16 @@ def compute_numeric(self, array: pa.Array) -> Dict:
result["p50"] = q_values[0]
result["p75"] = q_values[1]
result["p90"] = q_values[2]
- result["p95"] = q_values[3]
- result["p99"] = q_values[4]
-
- np_array = float_array.to_numpy()
- counts, bin_edges = np.histogram(np_array, bins=self.histogram_bins)
- result["histogram"] = {
- "bins": bin_edges.tolist(),
- "counts": counts.tolist(),
- "bin_width": float(bin_edges[1] - bin_edges[0])
- if len(bin_edges) > 1
+ result["p95"] = q_values[3] # type: ignore
+ result["p99"] = q_values[4] # type: ignore
+
+ np_array = float_array.to_numpy() # type: ignore
+ counts, bin_edges = np.histogram(np_array, bins=self.histogram_bins) # type: ignore
+ result["histogram"] = { # type: ignore
+ "bins": bin_edges.tolist(), # type: ignore
+ "counts": counts.tolist(), # type: ignore
+ "bin_width": float(bin_edges[1] - bin_edges[0]) # type: ignore
+ if len(bin_edges) > 1 # type: ignore
else 0,
}
diff --git a/sdk/python/feast/monitoring/monitoring_service.py b/sdk/python/feast/monitoring/monitoring_service.py
index ea15a1cdbae..f2995298917 100644
--- a/sdk/python/feast/monitoring/monitoring_service.py
+++ b/sdk/python/feast/monitoring/monitoring_service.py
@@ -3,9 +3,11 @@
import time
from collections import defaultdict
from datetime import date, datetime, timedelta, timezone
+from pathlib import Path
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
from feast.feature_logging import LOG_TIMESTAMP_FIELD, FeatureServiceLoggingSource
+from feast.infra.offline_stores.file_source import FileSource
from feast.infra.offline_stores.offline_store import OfflineStore
from feast.monitoring.dqm_job_manager import DQMJobManager
from feast.monitoring.metrics_calculator import MetricsCalculator
@@ -772,6 +774,146 @@ def get_timeseries(
end_date=end_date,
)
+ def get_date_buckets(
+ self,
+ project: str,
+ feature_view_name: Optional[str] = None,
+ feature_service_name: Optional[str] = None,
+ granularity: Optional[str] = None,
+ data_source_type: Optional[str] = None,
+ start_date: Optional[date] = None,
+ end_date: Optional[date] = None,
+ ) -> List[Dict[str, Any]]:
+ """Return distinct date buckets for the given filters."""
+ if feature_service_name:
+ metrics = self.get_feature_service_metrics(
+ project=project,
+ feature_service_name=feature_service_name,
+ granularity=granularity,
+ data_source_type=data_source_type,
+ start_date=start_date,
+ end_date=end_date,
+ )
+ elif feature_view_name:
+ metrics = self.get_feature_view_metrics(
+ project=project,
+ feature_view_name=feature_view_name,
+ granularity=granularity,
+ data_source_type=data_source_type,
+ start_date=start_date,
+ end_date=end_date,
+ )
+ else:
+ metrics = self.get_feature_metrics(
+ project=project,
+ granularity=granularity,
+ data_source_type=data_source_type,
+ start_date=start_date,
+ end_date=end_date,
+ )
+
+ buckets_map = {}
+ for m in metrics:
+ key = (
+ m.get("metric_date"),
+ m.get("granularity"),
+ m.get("data_source_type"),
+ )
+ if key not in buckets_map:
+ buckets_map[key] = {
+ "metric_date": m.get("metric_date"),
+ "granularity": m.get("granularity"),
+ "data_source_type": m.get("data_source_type"),
+ "max_event_timestamp": m.get("max_event_timestamp"),
+ "feature_computation_timestamp": m.get(
+ "feature_computation_timestamp"
+ ),
+ "export_timestamp": m.get("export_timestamp"),
+ "computed_at": m.get("computed_at"),
+ "is_baseline": m.get("is_baseline", False),
+ }
+ return list(buckets_map.values())
+
+ def get_profiles(
+ self,
+ project: str,
+ feature_view_name: str,
+ feature_name: Optional[str] = None,
+ granularity: Optional[str] = None,
+ start_date: Optional[date] = None,
+ end_date: Optional[date] = None,
+ ) -> Dict[str, Any]:
+ """Expose comprehensive profiles for a feature view including current metrics,
+ baseline metrics, provenance metadata, and source freshness."""
+ feature_metrics = self.get_feature_metrics(
+ project=project,
+ feature_view_name=feature_view_name,
+ feature_name=feature_name,
+ granularity=granularity,
+ start_date=start_date,
+ end_date=end_date,
+ )
+ baseline_metrics = self.get_baseline(
+ project=project,
+ feature_view_name=feature_view_name,
+ feature_name=feature_name,
+ )
+ fv_metrics = self.get_feature_view_metrics(
+ project=project,
+ feature_view_name=feature_view_name,
+ granularity=granularity,
+ start_date=start_date,
+ end_date=end_date,
+ )
+
+ provenance = {
+ "feature_view_name": feature_view_name,
+ "chronon_object": None,
+ "chronon_object_type": None,
+ "output_version": None,
+ "pipeline_run_id": None,
+ }
+ for m in feature_metrics + baseline_metrics:
+ for k in (
+ "chronon_object",
+ "chronon_object_type",
+ "output_version",
+ "pipeline_run_id",
+ ):
+ if m.get(k):
+ provenance[k] = m[k]
+ if provenance.get("chronon_object"):
+ break
+
+ max_event_ts = None
+ for m in feature_metrics:
+ ts_str = m.get("max_event_timestamp")
+ if ts_str:
+ dt = _as_utc_datetime(ts_str)
+ if dt and (max_event_ts is None or dt > max_event_ts):
+ max_event_ts = dt
+
+ freshness_seconds = None
+ if max_event_ts:
+ freshness_seconds = max(
+ 0.0, (datetime.now(timezone.utc) - max_event_ts).total_seconds()
+ )
+
+ return {
+ "project": project,
+ "feature_view_name": feature_view_name,
+ "provenance": provenance,
+ "source_freshness": {
+ "max_event_timestamp": max_event_ts.isoformat()
+ if max_event_ts
+ else None,
+ "freshness_seconds": freshness_seconds,
+ },
+ "feature_metrics": feature_metrics,
+ "baseline_metrics": baseline_metrics,
+ "feature_view_metrics": fv_metrics,
+ }
+
# ------------------------------------------------------------------ #
# Auto-baseline trigger for feast apply
# ------------------------------------------------------------------ #
@@ -918,6 +1060,48 @@ def _save_computed_metrics(
feature_view_name=feature_view.name,
)
+ batch_source = getattr(feature_view, "batch_source", None)
+ chronon_group_by = getattr(batch_source, "chronon_group_by", None) or None
+ chronon_join = getattr(batch_source, "chronon_join", None) or None
+ chronon_object = chronon_join or chronon_group_by or None
+ chronon_object_type = (
+ "join" if chronon_join else ("groupby" if chronon_group_by else None)
+ )
+ output_version = getattr(batch_source, "output_version", None) or None
+ pipeline_run_id = getattr(batch_source, "pipeline_run_id", None) or None
+
+ feature_comp_ts = None
+ created_col = getattr(batch_source, "created_timestamp_column", None)
+ if batch_source is not None and created_col:
+ try:
+ feature_comp_ts = self._get_max_timestamp_for_source(
+ batch_source, created_col
+ )
+ except Exception:
+ feature_comp_ts = None
+
+ export_ts = None
+ export_col = getattr(batch_source, "export_timestamp_column", None)
+ mat_path = getattr(batch_source, "materialization_path", None)
+ if batch_source is not None and export_col:
+ try:
+ export_ts = self._get_max_timestamp_for_source(batch_source, export_col)
+ except Exception:
+ export_ts = None
+ elif mat_path:
+ try:
+ resolved_path = FileSource.get_uri_for_file_path(
+ repo_path=config.repo_path,
+ uri=mat_path,
+ )
+ p = Path(resolved_path)
+ if p.exists():
+ export_ts = datetime.fromtimestamp(
+ p.stat().st_mtime, tz=timezone.utc
+ )
+ except Exception:
+ export_ts = None
+
for m in metrics_list:
m["project_id"] = project
m["feature_view_name"] = feature_view.name
@@ -926,6 +1110,12 @@ def _save_computed_metrics(
m["data_source_type"] = "batch"
m["computed_at"] = now
m["max_event_timestamp"] = max_event_timestamp
+ m["feature_computation_timestamp"] = feature_comp_ts
+ m["export_timestamp"] = export_ts
+ m["chronon_object"] = chronon_object
+ m["chronon_object_type"] = chronon_object_type
+ m["output_version"] = output_version
+ m["pipeline_run_id"] = pipeline_run_id
m["is_baseline"] = set_baseline
offline_store.save_monitoring_metrics(config, "feature", metrics_list)
@@ -938,6 +1128,12 @@ def _save_computed_metrics(
"data_source_type": "batch",
"computed_at": now,
"max_event_timestamp": max_event_timestamp,
+ "feature_computation_timestamp": feature_comp_ts,
+ "export_timestamp": export_ts,
+ "chronon_object": chronon_object,
+ "chronon_object_type": chronon_object_type,
+ "output_version": output_version,
+ "pipeline_run_id": pipeline_run_id,
"is_baseline": set_baseline,
**build_view_aggregate(metrics_list),
}
diff --git a/sdk/python/feast/monitoring/monitoring_utils.py b/sdk/python/feast/monitoring/monitoring_utils.py
index 2b4bc2d8b52..4cd2456bf43 100644
--- a/sdk/python/feast/monitoring/monitoring_utils.py
+++ b/sdk/python/feast/monitoring/monitoring_utils.py
@@ -37,6 +37,8 @@
"metric_date",
"computed_at",
"max_event_timestamp",
+ "feature_computation_timestamp",
+ "export_timestamp",
)
FEATURE_METRICS_COLUMNS: List[str] = [
@@ -48,6 +50,12 @@
"data_source_type",
"computed_at",
"max_event_timestamp",
+ "feature_computation_timestamp",
+ "export_timestamp",
+ "chronon_object",
+ "chronon_object_type",
+ "output_version",
+ "pipeline_run_id",
"is_baseline",
"feature_type",
"row_count",
@@ -82,6 +90,12 @@
"data_source_type",
"computed_at",
"max_event_timestamp",
+ "feature_computation_timestamp",
+ "export_timestamp",
+ "chronon_object",
+ "chronon_object_type",
+ "output_version",
+ "pipeline_run_id",
"is_baseline",
"total_row_count",
"total_features",
diff --git a/sdk/python/tests/integration/monitoring/test_chronon_dqm_integration.py b/sdk/python/tests/integration/monitoring/test_chronon_dqm_integration.py
new file mode 100644
index 00000000000..6ca86178aa5
--- /dev/null
+++ b/sdk/python/tests/integration/monitoring/test_chronon_dqm_integration.py
@@ -0,0 +1,673 @@
+"""Integration tests for Feast DQM (Data Quality Monitoring) with Chronon outputs (Issue #6984).
+
+Tests cover:
+1. Monitoring Storage & Hooks:
+ - Persistence hooks (ensure, save, query, clear_baseline, get_max_timestamp) in ChrononOfflineStore.
+ - Job state surviving process restarts.
+ - Metric upsert idempotence on retries (no duplicate rows).
+ - Baseline replacement without duplicate active baselines.
+2. Timestamps, Freshness & Lineage / Provenance:
+ - Online read returning feature timestamps for source freshness.
+ - Distinct timestamps: event time, feature-computation time, export time, metric-computation time.
+ - Missing timestamps / metadata explicitly handled as unknown/None.
+ - Provenance tracking: FeatureView, Chronon GroupBy/Join, output version, pipeline run ID.
+3. API/UI & Integration Fixtures:
+ - REST API / UI: Profiles, baselines, and date buckets endpoints.
+ - Null preservation (null_count, null_rate).
+ - Mapped feature names (`ChrononSource.field_mapping`).
+ - Multi-entity keys.
+ - Timestamp filtering.
+ - Known metric values (mean, stddev, quantiles, histograms).
+ - Stale-output fixture detecting data staleness.
+"""
+
+from datetime import date, datetime, timedelta, timezone
+from pathlib import Path
+from typing import Any, Dict
+from unittest.mock import MagicMock, patch
+
+import pandas as pd
+import pytest
+from fastapi import FastAPI
+from fastapi.testclient import TestClient
+
+from feast import Entity, FeatureStore, FeatureView, Field, RepoConfig
+from feast.api.registry.rest.monitoring import get_monitoring_router
+from feast.infra.offline_stores.contrib.chronon_offline_store.chronon import (
+ ChrononOfflineStore,
+)
+from feast.infra.offline_stores.contrib.chronon_offline_store.chronon_source import (
+ ChrononSource,
+)
+from feast.infra.online_stores.chronon_online_store.chronon import (
+ ChrononOnlineStore,
+ _parse_chronon_timestamp,
+)
+from feast.monitoring.dqm_job_manager import DQMJobManager
+from feast.monitoring.monitoring_service import MonitoringService
+from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
+from feast.protos.feast.types.Value_pb2 import Value as ValueProto
+from feast.repo_config import RegistryConfig
+from feast.types import Float32
+from feast.value_type import ValueType
+
+
+@pytest.fixture
+def repo_dir(tmp_path: Path) -> Path:
+ return tmp_path
+
+
+@pytest.fixture
+def feast_config(repo_dir: Path) -> RepoConfig:
+ cfg = RepoConfig(
+ project="test_chronon_dqm",
+ registry=RegistryConfig(path=str(repo_dir / "registry.db")),
+ provider="chronon",
+ offline_store={"type": "chronon", "path": str(repo_dir / "offline")},
+ online_store={"type": "chronon", "path": "http://localhost:8080"},
+ data_quality_monitoring={"auto_baseline": True},
+ )
+ cfg.repo_path = repo_dir
+ return cfg
+
+
+# ------------------------------------------------------------------ #
+# 1. Monitoring Storage & Hooks Tests
+# ------------------------------------------------------------------ #
+
+
+@pytest.mark.integration
+def test_chronon_offline_store_monitoring_persistence_and_job_restart_survival(
+ feast_config: RepoConfig,
+):
+ """Verify DQM job lifecycle and state survive simulated service restarts."""
+ offline_store = ChrononOfflineStore()
+ offline_store.ensure_monitoring_tables(feast_config)
+
+ job_manager_1 = DQMJobManager(offline_store, feast_config)
+ job_id = job_manager_1.submit(
+ project=feast_config.project,
+ job_type="auto_compute",
+ feature_view_name="driver_stats",
+ parameters={"sample_param": "value1"},
+ )
+
+ job = job_manager_1.get_job(job_id, project=feast_config.project)
+ assert job is not None
+ assert job["status"] == "pending"
+ assert job["parameters"] == {"sample_param": "value1"}
+
+ job_manager_1.update_status(
+ job_id,
+ status="completed",
+ result_summary={"computed_features": 5, "duration_ms": 120},
+ )
+
+ # Simulate process restart by instantiating a completely new JobManager
+ job_manager_restarted = DQMJobManager(offline_store, feast_config)
+ restored_job = job_manager_restarted.get_job(job_id, project=feast_config.project)
+
+ assert restored_job is not None
+ assert restored_job["status"] == "completed"
+ assert restored_job["result_summary"] == {
+ "computed_features": 5,
+ "duration_ms": 120,
+ }
+ assert restored_job["completed_at"] is not None
+
+
+@pytest.mark.integration
+def test_chronon_offline_store_retry_idempotence(feast_config: RepoConfig):
+ """Verify retrying metric saves updates existing records rather than duplicating them."""
+ offline_store = ChrononOfflineStore()
+ offline_store.ensure_monitoring_tables(feast_config)
+
+ metric_row: Dict[str, Any] = {
+ "project_id": feast_config.project,
+ "feature_view_name": "user_features",
+ "feature_name": "rating",
+ "metric_date": date(2025, 1, 1),
+ "granularity": "daily",
+ "data_source_type": "batch",
+ "computed_at": datetime(2025, 1, 1, 12, 0, tzinfo=timezone.utc),
+ "max_event_timestamp": datetime(2025, 1, 1, 10, 0, tzinfo=timezone.utc),
+ "is_baseline": False,
+ "feature_type": "numeric",
+ "row_count": 100,
+ "null_count": 5,
+ "null_rate": 0.05,
+ "mean": 4.2,
+ "stddev": 0.5,
+ }
+
+ # First write
+ offline_store.save_monitoring_metrics(feast_config, "feature", [metric_row])
+
+ # Retry with updated mean
+ retry_row = dict(metric_row)
+ retry_row["mean"] = 4.35
+ offline_store.save_monitoring_metrics(feast_config, "feature", [retry_row])
+
+ rows = offline_store.query_monitoring_metrics(
+ config=feast_config,
+ project=feast_config.project,
+ metric_type="feature",
+ filters={"feature_view_name": "user_features", "feature_name": "rating"},
+ )
+ assert len(rows) == 1
+ assert rows[0]["mean"] == 4.35
+
+
+@pytest.mark.integration
+def test_chronon_offline_store_baseline_replacement(feast_config: RepoConfig):
+ """Verify clear_monitoring_baseline replaces baseline correctly without duplicates."""
+ offline_store = ChrononOfflineStore()
+ offline_store.ensure_monitoring_tables(feast_config)
+
+ old_baseline = {
+ "project_id": feast_config.project,
+ "feature_view_name": "user_features",
+ "feature_name": "score",
+ "metric_date": date(2025, 1, 1),
+ "granularity": "baseline",
+ "data_source_type": "batch",
+ "computed_at": datetime(2025, 1, 1, 10, 0, tzinfo=timezone.utc),
+ "is_baseline": True,
+ "feature_type": "numeric",
+ "row_count": 500,
+ "null_rate": 0.0,
+ "mean": 10.0,
+ }
+ offline_store.save_monitoring_metrics(feast_config, "feature", [old_baseline])
+
+ baselines_before = offline_store.query_monitoring_metrics(
+ config=feast_config,
+ project=feast_config.project,
+ metric_type="feature",
+ filters={"feature_view_name": "user_features", "is_baseline": True},
+ )
+ assert len(baselines_before) == 1
+ assert baselines_before[0]["mean"] == 10.0
+
+ # Replace baseline
+ offline_store.clear_monitoring_baseline(
+ config=feast_config,
+ project=feast_config.project,
+ feature_view_name="user_features",
+ )
+ new_baseline = dict(old_baseline)
+ new_baseline["metric_date"] = date(2025, 1, 2)
+ new_baseline["mean"] = 15.0
+ offline_store.save_monitoring_metrics(feast_config, "feature", [new_baseline])
+
+ baselines_after = offline_store.query_monitoring_metrics(
+ config=feast_config,
+ project=feast_config.project,
+ metric_type="feature",
+ filters={"feature_view_name": "user_features", "is_baseline": True},
+ )
+ assert len(baselines_after) == 1
+ assert baselines_after[0]["mean"] == 15.0
+ assert baselines_after[0]["metric_date"] == "2025-01-02"
+
+
+# ------------------------------------------------------------------ #
+# 2. Timestamps, Freshness & Lineage / Provenance Tests
+# ------------------------------------------------------------------ #
+
+
+@pytest.mark.integration
+def test_chronon_online_read_returns_freshness_timestamp():
+ """Verify online reads parse response timestamps into datetimes or None for unknown."""
+ # Test milliseconds Unix timestamp parsing
+ ts_ms = 1704067200000 # 2024-01-01T00:00:00Z in ms
+ parsed = _parse_chronon_timestamp({"ts": ts_ms})
+ assert parsed == datetime(2024, 1, 1, 0, 0, 0, tzinfo=timezone.utc)
+
+ # Test seconds Unix timestamp
+ ts_sec = 1704067200
+ assert _parse_chronon_timestamp({"timestamp": ts_sec}) == datetime(
+ 2024, 1, 1, 0, 0, 0, tzinfo=timezone.utc
+ )
+
+ # Test ISO string
+ assert _parse_chronon_timestamp(
+ {"event_timestamp": "2024-01-01T00:00:00Z"}
+ ) == datetime(2024, 1, 1, 0, 0, 0, tzinfo=timezone.utc)
+
+ # Missing timestamps handled explicitly as unknown (None)
+ assert _parse_chronon_timestamp({"other_field": 123}) is None
+ assert _parse_chronon_timestamp({}) is None
+
+
+@pytest.mark.integration
+def test_chronon_online_store_online_read_freshness_integration(
+ feast_config: RepoConfig, tmp_path: Path
+):
+ """Verify online_read integrates timestamp for source freshness."""
+ online_store = ChrononOnlineStore()
+ user = Entity(name="user", join_keys=["user_id"], value_type=ValueType.INT64)
+ fv = FeatureView(
+ name="user_fv",
+ entities=[user],
+ schema=[Field(name="feature_a", dtype=Float32)],
+ source=ChrononSource(
+ materialization_path=str(tmp_path / "dummy.parquet"),
+ chronon_join="team/users.v1",
+ timestamp_field="event_timestamp",
+ ),
+ )
+
+ ek = EntityKeyProto(
+ join_keys=["user_id"],
+ entity_values=[ValueProto(int64_val=42)],
+ )
+
+ mock_resp = MagicMock()
+ mock_resp.json.return_value = {
+ "results": [
+ {
+ "status": "Success",
+ "ts": 1704067200000,
+ "features": {"feature_a": 3.14},
+ }
+ ]
+ }
+ mock_resp.raise_for_status.return_value = None
+
+ mock_session = MagicMock()
+ mock_session.post.return_value = mock_resp
+
+ with patch(
+ "feast.permissions.client.http_auth_requests_wrapper.HttpSessionManager.get_session",
+ return_value=mock_session,
+ ):
+ results = online_store.online_read(
+ config=feast_config,
+ table=fv,
+ entity_keys=[ek],
+ )
+
+ assert len(results) == 1
+ ts, features = results[0]
+ assert ts == datetime(2024, 1, 1, 0, 0, 0, tzinfo=timezone.utc)
+ assert features is not None
+ assert "feature_a" in features
+
+
+@pytest.mark.integration
+def test_chronon_dqm_distinct_timestamps_and_provenance(
+ feast_config: RepoConfig, repo_dir: Path
+):
+ """Verify event time, feature-computation time, export time, and metric-computation time
+
+ are kept distinct, with provenance properly tracked.
+ """
+ data_path = repo_dir / "chronon_distinct_ts.parquet"
+ event_ts = datetime(2025, 2, 1, 10, 0, 0, tzinfo=timezone.utc)
+ comp_ts = datetime(2025, 2, 1, 11, 30, 0, tzinfo=timezone.utc)
+
+ pd.DataFrame(
+ {
+ "user_id": [1, 2, 3],
+ "event_time": [event_ts, event_ts, event_ts],
+ "feature_calc_time": [comp_ts, comp_ts, comp_ts],
+ "rating": [4.0, 5.0, 3.0],
+ }
+ ).to_parquet(data_path)
+
+ store = FeatureStore(config=feast_config)
+ user = Entity(name="user", join_keys=["user_id"], value_type=ValueType.INT64)
+ source = ChrononSource(
+ name="user_ratings_src",
+ materialization_path=str(data_path),
+ chronon_group_by="team/user_ratings_groupby.v1",
+ timestamp_field="event_time",
+ created_timestamp_column="feature_calc_time",
+ output_version="v3.0",
+ pipeline_run_id="run_abc_123",
+ )
+ fv = FeatureView(
+ name="user_ratings",
+ entities=[user],
+ schema=[Field(name="rating", dtype=Float32)],
+ source=source,
+ )
+ store.apply([user, fv])
+
+ service = MonitoringService(store)
+ now = datetime(2025, 2, 2, 12, 0, 0, tzinfo=timezone.utc)
+
+ service._save_computed_metrics(
+ project=feast_config.project,
+ feature_view=fv,
+ metrics_list=[
+ {
+ "feature_name": "rating",
+ "feature_type": "numeric",
+ "row_count": 3,
+ "null_count": 0,
+ "null_rate": 0.0,
+ "mean": 4.0,
+ }
+ ],
+ metric_date=date(2025, 2, 1),
+ granularity="daily",
+ set_baseline=False,
+ now=now,
+ max_event_timestamp=event_ts,
+ )
+
+ metrics = service.get_feature_metrics(
+ project=feast_config.project,
+ feature_view_name="user_ratings",
+ )
+ assert len(metrics) == 1
+ m = metrics[0]
+
+ # Check distinct timestamps
+ assert m["max_event_timestamp"] == event_ts.isoformat()
+ assert m["feature_computation_timestamp"] == comp_ts.isoformat()
+ assert m["computed_at"] == now.isoformat()
+ assert m["export_timestamp"] is not None # Derived from file stat mtime
+
+ # Verify event time != feature-computation time != export time != metric-computation time
+ assert m["max_event_timestamp"] != m["feature_computation_timestamp"]
+ assert m["feature_computation_timestamp"] != m["computed_at"]
+
+ # Check provenance context
+ assert m["chronon_object"] == "team/user_ratings_groupby.v1"
+ assert m["chronon_object_type"] == "groupby"
+ assert m["output_version"] == "v3.0"
+ assert m["pipeline_run_id"] == "run_abc_123"
+
+
+# ------------------------------------------------------------------ #
+# 3. Null Preservation, Mapped Names, Known Metrics & Stale Fixture
+# ------------------------------------------------------------------ #
+
+
+@pytest.mark.integration
+def test_chronon_dqm_null_preservation_mapped_names_and_known_values(
+ feast_config: RepoConfig, repo_dir: Path
+):
+ """Verify null preservation, field mappings, multi-entity keys, and exact metric values."""
+ data_path = repo_dir / "chronon_stats.parquet"
+
+ # Known distribution: 10 rows, 2 nulls (null_rate = 0.2)
+ # Non-null values: 10, 20, 30, 50, 70, 80, 90, 100 -> sum = 450, mean = 56.25
+ timestamps = [
+ datetime(2025, 1, 1, 1, 0, tzinfo=timezone.utc) + timedelta(hours=i)
+ for i in range(10)
+ ]
+ pd.DataFrame(
+ {
+ "user_id": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
+ "merchant_id": [101, 102, 101, 102, 103, 101, 102, 103, 101, 102],
+ "raw_timestamp": timestamps,
+ "raw_feature_val": [
+ 10.0,
+ 20.0,
+ 30.0,
+ None,
+ 50.0,
+ None,
+ 70.0,
+ 80.0,
+ 90.0,
+ 100.0,
+ ],
+ }
+ ).to_parquet(data_path)
+
+ store = FeatureStore(config=feast_config)
+ user = Entity(name="user", join_keys=["user_id"], value_type=ValueType.INT64)
+ merchant = Entity(
+ name="merchant", join_keys=["merchant_id"], value_type=ValueType.INT64
+ )
+ source = ChrononSource(
+ name="txn_source",
+ materialization_path=str(data_path),
+ chronon_join="team/transactions.v1",
+ timestamp_field="event_timestamp",
+ field_mapping={
+ "raw_timestamp": "event_timestamp",
+ "raw_feature_val": "amount",
+ },
+ )
+ fv = FeatureView(
+ name="txn_stats",
+ entities=[user, merchant],
+ schema=[Field(name="amount", dtype=Float32)],
+ source=source,
+ )
+ store.apply([user, merchant, fv])
+
+ service = MonitoringService(store)
+ result = service.compute_metrics(
+ project=feast_config.project,
+ feature_view_name="txn_stats",
+ start_date=date(2025, 1, 1),
+ end_date=date(2025, 1, 2),
+ granularity="daily",
+ )
+ assert result["status"] == "completed"
+
+ metrics = service.get_feature_metrics(
+ project=feast_config.project,
+ feature_view_name="txn_stats",
+ )
+ assert len(metrics) == 1
+ m = metrics[0]
+
+ # Verify mapped feature name
+ assert m["feature_name"] == "amount"
+
+ # Verify null preservation
+ assert m["row_count"] == 10
+ assert m["null_count"] == 2
+ assert m["null_rate"] == pytest.approx(0.2)
+
+ # Verify known metric values
+ assert m["mean"] == pytest.approx(56.25)
+ assert m["min_val"] == pytest.approx(10.0)
+ assert m["max_val"] == pytest.approx(100.0)
+ assert m["histogram"] is not None
+
+
+@pytest.mark.integration
+def test_chronon_dqm_timestamp_filtering(feast_config: RepoConfig, repo_dir: Path):
+ """Verify timestamp filtering only computes metrics on data within requested window."""
+ data_path = repo_dir / "chronon_time_filter.parquet"
+
+ # 5 rows spanning Jan 1 to Jan 5
+ pd.DataFrame(
+ {
+ "user_id": [1, 2, 3, 4, 5],
+ "event_timestamp": [
+ datetime(2025, 1, 1, 12, 0, tzinfo=timezone.utc),
+ datetime(2025, 1, 2, 12, 0, tzinfo=timezone.utc),
+ datetime(2025, 1, 3, 12, 0, tzinfo=timezone.utc),
+ datetime(2025, 1, 4, 12, 0, tzinfo=timezone.utc),
+ datetime(2025, 1, 5, 12, 0, tzinfo=timezone.utc),
+ ],
+ "val": [10.0, 20.0, 30.0, 40.0, 50.0],
+ }
+ ).to_parquet(data_path)
+
+ store = FeatureStore(config=feast_config)
+ user = Entity(name="user", join_keys=["user_id"], value_type=ValueType.INT64)
+ fv = FeatureView(
+ name="time_filtered_fv",
+ entities=[user],
+ schema=[Field(name="val", dtype=Float32)],
+ source=ChrononSource(
+ materialization_path=str(data_path),
+ chronon_join="team/time_join.v1",
+ timestamp_field="event_timestamp",
+ ),
+ )
+ store.apply([user, fv])
+
+ service = MonitoringService(store)
+ # Compute for Jan 2 to Jan 3 (2 rows: 20.0, 30.0 -> mean = 25.0)
+ result = service.compute_metrics(
+ project=feast_config.project,
+ feature_view_name="time_filtered_fv",
+ start_date=date(2025, 1, 2),
+ end_date=date(2025, 1, 3),
+ granularity="daily",
+ )
+ assert result["status"] == "completed"
+
+ metrics = service.get_feature_metrics(
+ project=feast_config.project,
+ feature_view_name="time_filtered_fv",
+ )
+ assert len(metrics) == 1
+ m = metrics[0]
+ assert m["row_count"] == 2
+ assert m["mean"] == pytest.approx(25.0)
+
+
+@pytest.mark.integration
+def test_chronon_dqm_stale_output_fixture(feast_config: RepoConfig, repo_dir: Path):
+ """Verify source freshness reporting identifies stale outputs correctly."""
+ data_path = repo_dir / "chronon_stale.parquet"
+
+ # Data from 30 days ago
+ stale_event_time = datetime.now(timezone.utc) - timedelta(days=30)
+ pd.DataFrame(
+ {
+ "user_id": [1, 2],
+ "event_timestamp": [stale_event_time, stale_event_time],
+ "metric": [1.0, 2.0],
+ }
+ ).to_parquet(data_path)
+
+ store = FeatureStore(config=feast_config)
+ user = Entity(name="user", join_keys=["user_id"], value_type=ValueType.INT64)
+ fv = FeatureView(
+ name="stale_fv",
+ entities=[user],
+ schema=[Field(name="metric", dtype=Float32)],
+ source=ChrononSource(
+ materialization_path=str(data_path),
+ chronon_join="team/stale_join.v1",
+ timestamp_field="event_timestamp",
+ ),
+ )
+ store.apply([user, fv])
+
+ service = MonitoringService(store)
+ service.compute_metrics(
+ project=feast_config.project,
+ feature_view_name="stale_fv",
+ start_date=stale_event_time.date(),
+ end_date=stale_event_time.date(),
+ )
+
+ profile = service.get_profiles(
+ project=feast_config.project,
+ feature_view_name="stale_fv",
+ )
+
+ assert "source_freshness" in profile
+ freshness = profile["source_freshness"]
+ assert freshness["max_event_timestamp"] is not None
+ # Data is 30 days old -> freshness_seconds should be approx 30 * 86400 seconds
+ assert freshness["freshness_seconds"] > 25 * 86400
+
+
+# ------------------------------------------------------------------ #
+# 4. REST API Profiles, Baselines, and Date Buckets Tests
+# ------------------------------------------------------------------ #
+
+
+@pytest.mark.integration
+def test_chronon_dqm_rest_api_profiles_and_date_buckets(
+ feast_config: RepoConfig, repo_dir: Path
+):
+ """Verify REST API exposes profiles, baselines, and date buckets with provenance."""
+ data_path = repo_dir / "chronon_api.parquet"
+ pd.DataFrame(
+ {
+ "user_id": [1, 2, 3],
+ "event_timestamp": [
+ datetime(2025, 3, 1, 10, 0, tzinfo=timezone.utc),
+ datetime(2025, 3, 2, 10, 0, tzinfo=timezone.utc),
+ datetime(2025, 3, 3, 10, 0, tzinfo=timezone.utc),
+ ],
+ "feature_val": [100.0, 200.0, 300.0],
+ }
+ ).to_parquet(data_path)
+
+ store = FeatureStore(config=feast_config)
+ user = Entity(name="user", join_keys=["user_id"], value_type=ValueType.INT64)
+ fv = FeatureView(
+ name="api_fv",
+ entities=[user],
+ schema=[Field(name="feature_val", dtype=Float32)],
+ source=ChrononSource(
+ materialization_path=str(data_path),
+ chronon_join="team/api_join.v1",
+ timestamp_field="event_timestamp",
+ output_version="v1.0",
+ pipeline_run_id="run_rest_test",
+ ),
+ )
+ store.apply([user, fv])
+
+ service = MonitoringService(store)
+ # Compute daily metrics
+ service.compute_metrics(
+ project=feast_config.project,
+ feature_view_name="api_fv",
+ start_date=date(2025, 3, 1),
+ end_date=date(2025, 3, 3),
+ granularity="daily",
+ )
+ # Compute baseline
+ service.compute_baseline(
+ project=feast_config.project,
+ feature_view_name="api_fv",
+ )
+
+ # Build FastAPI test client with Feast monitoring router
+ app = FastAPI()
+ router = get_monitoring_router(MagicMock(), store=store)
+ app.include_router(router)
+ client = TestClient(app)
+
+ # 1. Test GET /monitoring/date_buckets
+ res_buckets = client.get(
+ f"/monitoring/date_buckets?project={feast_config.project}&feature_view_name=api_fv"
+ )
+ assert res_buckets.status_code == 200
+ buckets = res_buckets.json()
+ assert isinstance(buckets, list)
+ assert len(buckets) >= 1
+ assert any(b.get("granularity") == "daily" for b in buckets)
+
+ # 2. Test GET /monitoring/profiles
+ res_profiles = client.get(
+ f"/monitoring/profiles?project={feast_config.project}&feature_view_name=api_fv"
+ )
+ assert res_profiles.status_code == 200
+ profile_data = res_profiles.json()
+ assert profile_data["feature_view_name"] == "api_fv"
+ assert profile_data["provenance"]["chronon_object"] == "team/api_join.v1"
+ assert profile_data["provenance"]["output_version"] == "v1.0"
+ assert profile_data["provenance"]["pipeline_run_id"] == "run_rest_test"
+ assert len(profile_data["feature_metrics"]) >= 1
+ assert len(profile_data["baseline_metrics"]) >= 1
+
+ # 3. Test GET /monitoring/metrics/baseline
+ res_baseline = client.get(
+ f"/monitoring/metrics/baseline?project={feast_config.project}&feature_view_name=api_fv"
+ )
+ assert res_baseline.status_code == 200
+ baseline_rows = res_baseline.json()
+ assert len(baseline_rows) == 1
+ assert baseline_rows[0]["is_baseline"] is True
+ assert baseline_rows[0]["chronon_object"] == "team/api_join.v1"
diff --git a/ui/src/pages/monitoring/FeatureMetricsTable.tsx b/ui/src/pages/monitoring/FeatureMetricsTable.tsx
index c3f775757ee..6582bbade63 100644
--- a/ui/src/pages/monitoring/FeatureMetricsTable.tsx
+++ b/ui/src/pages/monitoring/FeatureMetricsTable.tsx
@@ -372,6 +372,29 @@ const FeatureMetricsTable = ({
width: "80px",
render: (val: string) => {val},
},
+ {
+ field: "chronon_object" as any,
+ name: "Provenance",
+ width: "120px",
+ render: (_val: string | null, item: FeatureMetric) => {
+ if (!item.chronon_object && !item.output_version) return "—";
+ const label = item.chronon_object
+ ? `${item.chronon_object_type ? item.chronon_object_type + ": " : ""}${item.chronon_object}`
+ : item.output_version || "—";
+ const details = [
+ item.chronon_object ? `Object: ${item.chronon_object}` : null,
+ item.output_version ? `Version: ${item.output_version}` : null,
+ item.pipeline_run_id ? `Run: ${item.pipeline_run_id}` : null,
+ ]
+ .filter(Boolean)
+ .join(" | ");
+ return (
+
+ {item.chronon_object || item.output_version}
+
+ );
+ },
+ },
];
return (
diff --git a/ui/src/queries/useMonitoringApi.ts b/ui/src/queries/useMonitoringApi.ts
index a390b50541b..ceef6067723 100644
--- a/ui/src/queries/useMonitoringApi.ts
+++ b/ui/src/queries/useMonitoringApi.ts
@@ -13,6 +13,12 @@ interface FeatureMetric {
data_source_type: string;
computed_at: string;
max_event_timestamp: string | null;
+ feature_computation_timestamp?: string | null;
+ export_timestamp?: string | null;
+ chronon_object?: string | null;
+ chronon_object_type?: string | null;
+ output_version?: string | null;
+ pipeline_run_id?: string | null;
is_baseline: boolean;
feature_type: string;
row_count: number;
@@ -50,6 +56,12 @@ interface FeatureViewMetric {
data_source_type: string;
computed_at: string;
max_event_timestamp: string | null;
+ feature_computation_timestamp?: string | null;
+ export_timestamp?: string | null;
+ chronon_object?: string | null;
+ chronon_object_type?: string | null;
+ output_version?: string | null;
+ pipeline_run_id?: string | null;
is_baseline: boolean;
total_row_count: number;
total_features: number;
@@ -66,6 +78,12 @@ interface FeatureServiceMetric {
data_source_type: string;
computed_at: string;
max_event_timestamp: string | null;
+ feature_computation_timestamp?: string | null;
+ export_timestamp?: string | null;
+ chronon_object?: string | null;
+ chronon_object_type?: string | null;
+ output_version?: string | null;
+ pipeline_run_id?: string | null;
is_baseline: boolean;
total_feature_views: number;
total_features: number;
@@ -304,6 +322,78 @@ const useComputeMetrics = () => {
);
};
+interface DateBucket {
+ metric_date: string;
+ granularity: string;
+ data_source_type: string;
+ max_event_timestamp: string | null;
+ feature_computation_timestamp: string | null;
+ export_timestamp: string | null;
+ computed_at: string;
+ is_baseline: boolean;
+}
+
+interface FeatureProfile {
+ project: string;
+ feature_view_name: string;
+ provenance: {
+ feature_view_name: string;
+ chronon_object: string | null;
+ chronon_object_type: string | null;
+ output_version: string | null;
+ pipeline_run_id: string | null;
+ };
+ source_freshness: {
+ max_event_timestamp: string | null;
+ freshness_seconds: number | null;
+ };
+ feature_metrics: FeatureMetric[];
+ baseline_metrics: FeatureMetric[];
+ feature_view_metrics: FeatureViewMetric[];
+}
+
+const useDateBuckets = (filters: MonitoringFilters) => {
+ const { apiBaseUrl } = useContext(MonitoringContext);
+ const { fetchOptions } = useDataMode();
+ return useQuery(
+ ["monitoring-date-buckets", filters],
+ () =>
+ fetchMonitoring(
+ apiBaseUrl,
+ "/monitoring/date_buckets",
+ toQueryParams(filters),
+ fetchOptions,
+ ),
+ { staleTime: STALE_TIME, retry: 1 },
+ );
+};
+
+const useFeatureProfile = (
+ project: string,
+ featureViewName: string,
+ featureName?: string,
+ granularity?: string,
+) => {
+ const { apiBaseUrl } = useContext(MonitoringContext);
+ const { fetchOptions } = useDataMode();
+ return useQuery(
+ ["monitoring-profile", project, featureViewName, featureName, granularity],
+ () =>
+ fetchMonitoring(
+ apiBaseUrl,
+ "/monitoring/profiles",
+ {
+ project,
+ feature_view_name: featureViewName,
+ feature_name: featureName,
+ granularity,
+ },
+ fetchOptions,
+ ),
+ { staleTime: STALE_TIME, retry: 1 },
+ );
+};
+
export {
isServiceUnavailable,
useFeatureMetrics,
@@ -311,6 +401,8 @@ export {
useFeatureServiceMetrics,
useBaselineMetrics,
useComputeMetrics,
+ useDateBuckets,
+ useFeatureProfile,
};
export type {
FeatureMetric,
@@ -319,4 +411,6 @@ export type {
NumericHistogram,
CategoricalHistogram,
MonitoringFilters,
+ DateBucket,
+ FeatureProfile,
};