Skip to content

Commit 40e6758

Browse files
Renaming to allow for api-reporting update (frequenz-floss#205)
2 parents 73cbce9 + 0668841 commit 40e6758

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## Upgrading
88

9-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
9+
* Update to frequenz-api-reporting v0.8.0
1010

1111
## New Features
1212

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ requires-python = ">= 3.11, < 4"
2828
dependencies = [
2929
"typing_extensions >= 4.6.1, < 5",
3030
"grpc-stubs == 1.53.0.6",
31-
"frequenz-api-reporting >= 0.7.0, < 0.8",
31+
"frequenz-api-reporting >= 0.8.0, < 0.9",
3232
"frequenz-client-common >= 0.3.0, < 0.4",
33-
"grpcio >=1.70.0, < 2",
34-
"protobuf >= 5.29.3, < 7",
33+
"grpcio >=1.72.1, < 2",
34+
"protobuf >=6.31.1, < 7",
3535
"frequenz-client-base >= 0.11.0, < 0.12.0",
3636
]
3737
dynamic = ["version"]

src/frequenz/client/reporting/_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ def dt2ts(dt: datetime) -> PBTimestamp:
260260
return ts
261261

262262
time_filter = PBTimeFilter(
263-
start=dt2ts(start_time) if start_time else None,
264-
end=dt2ts(end_time) if end_time else None,
263+
start_time=dt2ts(start_time) if start_time else None,
264+
end_time=dt2ts(end_time) if end_time else None,
265265
)
266266

267267
incl_states = (
@@ -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)