@@ -92,7 +92,7 @@ def __iter__(self) -> Iterator[MetricSample]:
9292 for item in items :
9393 cid = getattr (item , self .id_attr )
9494 for sample in getattr (item , "metric_samples" , []):
95- ts = sample .sampled_at .ToDatetime ().replace (tzinfo = timezone .utc )
95+ ts = sample .sample_time .ToDatetime ().replace (tzinfo = timezone .utc )
9696 met = Metric .from_proto (sample .metric ).name
9797
9898 # Handle simple_metric
@@ -127,7 +127,7 @@ def __iter__(self) -> Iterator[MetricSample]:
127127 )
128128
129129 for state in getattr (item , "states" , []):
130- ts = state .sampled_at .ToDatetime ().replace (tzinfo = timezone .utc )
130+ ts = state .sample_time .ToDatetime ().replace (tzinfo = timezone .utc )
131131 for category , category_items in {
132132 "state" : getattr (state , "states" , []),
133133 "warning" : getattr (state , "warnings" , []),
@@ -177,7 +177,7 @@ class AggregatedMetric:
177177 def sample (self ) -> MetricSample :
178178 """Return the aggregated metric sample."""
179179 return MetricSample (
180- timestamp = self ._data_pb .sample .sampled_at .ToDatetime ().replace (
180+ timestamp = self ._data_pb .sample .sample_time .ToDatetime ().replace (
181181 tzinfo = timezone .utc
182182 ),
183183 microgrid_id = self ._data_pb .aggregation_config .microgrid_id ,
0 commit comments