Skip to content

Commit 5429a06

Browse files
Renaming to allow for api-reporting update
Signed-off-by: Flora <[email protected]>
1 parent 73cbce9 commit 5429a06

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/frequenz/client/reporting/_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,8 @@ def dt2ts(dt: datetime) -> PBTimestamp:
450450
return ts
451451

452452
time_filter = PBTimeFilter(
453-
start=dt2ts(start_time) if start_time else None,
454-
end=dt2ts(end_time) if end_time else None,
453+
start_time=dt2ts(start_time) if start_time else None,
454+
end_time=dt2ts(end_time) if end_time else None,
455455
)
456456

457457
incl_states = (
@@ -566,8 +566,8 @@ def dt2ts(dt: datetime) -> PBTimestamp:
566566
return ts
567567

568568
time_filter = PBTimeFilter(
569-
start=dt2ts(start_time) if start_time else None,
570-
end=dt2ts(end_time) if end_time else None,
569+
start_time=dt2ts(start_time) if start_time else None,
570+
end_time=dt2ts(end_time) if end_time else None,
571571
)
572572

573573
stream_filter = PBAggregatedStreamRequest.AggregationStreamFilter(

src/frequenz/client/reporting/_types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)