3737 RepoConfig ,
3838 load_repo_config ,
3939)
40+ from feast .telemetry import Telemetry
4041from feast .type_map import python_value_to_proto_value
42+ from feast .version import get_version
4143
4244
4345class FeatureStore :
@@ -74,6 +76,12 @@ def __init__(
7476 registry_path = registry_config .path ,
7577 cache_ttl = timedelta (seconds = registry_config .cache_ttl_seconds ),
7678 )
79+ self ._tele = Telemetry ()
80+
81+ def version (self ) -> str :
82+ """Returns the version of the current Feast SDK/CLI"""
83+
84+ return get_version ()
7785
7886 @property
7987 def project (self ) -> str :
@@ -96,6 +104,7 @@ def refresh_registry(self):
96104 greater than 0, then once the cache becomes stale (more time than the TTL has passed), a new cache will be
97105 downloaded synchronously, which may increase latencies if the triggering method is get_online_features()
98106 """
107+ self ._tele .log ("refresh_registry" )
99108
100109 registry_config = self .config .get_registry_config ()
101110 self ._registry = Registry (
@@ -111,6 +120,8 @@ def list_entities(self) -> List[Entity]:
111120 Returns:
112121 List of entities
113122 """
123+ self ._tele .log ("list_entities" )
124+
114125 return self ._registry .list_entities (self .project )
115126
116127 def list_feature_views (self ) -> List [FeatureView ]:
@@ -120,6 +131,8 @@ def list_feature_views(self) -> List[FeatureView]:
120131 Returns:
121132 List of feature views
122133 """
134+ self ._tele .log ("list_feature_views" )
135+
123136 return self ._registry .list_feature_views (self .project )
124137
125138 def get_entity (self , name : str ) -> Entity :
@@ -133,6 +146,8 @@ def get_entity(self, name: str) -> Entity:
133146 Returns either the specified entity, or raises an exception if
134147 none is found
135148 """
149+ self ._tele .log ("get_entity" )
150+
136151 return self ._registry .get_entity (name , self .project )
137152
138153 def get_feature_view (self , name : str ) -> FeatureView :
@@ -146,6 +161,8 @@ def get_feature_view(self, name: str) -> FeatureView:
146161 Returns either the specified feature view, or raises an exception if
147162 none is found
148163 """
164+ self ._tele .log ("get_feature_view" )
165+
149166 return self ._registry .get_feature_view (name , self .project )
150167
151168 def delete_feature_view (self , name : str ):
@@ -155,6 +172,8 @@ def delete_feature_view(self, name: str):
155172 Args:
156173 name: Name of feature view
157174 """
175+ self ._tele .log ("delete_feature_view" )
176+
158177 return self ._registry .delete_feature_view (name , self .project )
159178
160179 def apply (self , objects : List [Union [FeatureView , Entity ]]):
@@ -186,6 +205,8 @@ def apply(self, objects: List[Union[FeatureView, Entity]]):
186205 >>> fs.apply([customer_entity, customer_feature_view])
187206 """
188207
208+ self ._tele .log ("apply" )
209+
189210 # TODO: Add locking
190211 # TODO: Optimize by only making a single call (read/write)
191212
@@ -246,6 +267,7 @@ def get_historical_features(
246267 >>> feature_data = job.to_df()
247268 >>> model.fit(feature_data) # insert your modeling framework here.
248269 """
270+ self ._tele .log ("get_historical_features" )
249271
250272 all_feature_views = self ._registry .list_feature_views (
251273 project = self .config .project
@@ -282,6 +304,8 @@ def materialize_incremental(
282304 >>> fs = FeatureStore(config=RepoConfig(provider="gcp", registry="gs://my-fs/", project="my_fs_proj"))
283305 >>> fs.materialize_incremental(end_date=datetime.utcnow() - timedelta(minutes=5))
284306 """
307+ self ._tele .log ("materialize_incremental" )
308+
285309 feature_views_to_materialize = []
286310 if feature_views is None :
287311 feature_views_to_materialize = self ._registry .list_feature_views (
@@ -335,6 +359,8 @@ def materialize(
335359 >>> start_date=datetime.utcnow() - timedelta(hours=3), end_date=datetime.utcnow() - timedelta(minutes=10)
336360 >>> )
337361 """
362+ self ._tele .log ("materialize" )
363+
338364 feature_views_to_materialize = []
339365 if feature_views is None :
340366 feature_views_to_materialize = self ._registry .list_feature_views (
@@ -424,6 +450,7 @@ def get_online_features(
424450 >>> print(online_response_dict)
425451 {'sales:daily_transactions': [1.1,1.2], 'sales:customer_id': [0,1]}
426452 """
453+ self ._tele .log ("get_online_features" )
427454
428455 response = self ._get_online_features (
429456 feature_refs = feature_refs ,
0 commit comments