Skip to content

Commit a860ac2

Browse files
Upgrade to reporting API v0.5 (frequenz-floss#114)
This update includes `MetricConnections` in the request message, that comes with a breaking change in the API specs. To ensure compatibility, both the client and service must be updated simultaneously. Specifically: * This and later versions of the client can only be used with the latest reporting API service >=v0.7 but not with older versions of the service. * Older versions of the client can only be used with the reporting API service versions < v0.7 but no later versions.
2 parents 67b9708 + 9e66c57 commit a860ac2

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
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+
This update comes with a breaking change, that originates from a breaking change in the API specs. Specifically:
10+
* This and later versions of the client can only be used with the latest reporting API service >=v0.7 but not with older versions of the service.
11+
* Older versions of the client can only be used with the reporting API service versions < v0.7 but no later versions.
12+
To ensure compatibility, both the client and service must be updated simultaneously.
1013

1114
## New Features
1215

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ requires-python = ">= 3.11, < 4"
2828
dependencies = [
2929
"typing_extensions >= 4.6.1, < 5",
3030
"grpc-stubs == 1.53.0.5",
31-
"frequenz-api-reporting >= 0.2.0, < 0.5",
31+
"frequenz-api-reporting >= 0.5.0, < 0.6",
3232
"frequenz-client-common >= 0.2.0, < 0.3",
33-
"grpcio >= 1.54.2, < 2",
34-
"grpcio-tools >= 1.54.2, < 2",
35-
"protobuf >= 4.25.3, < 6",
33+
"grpcio >=1.66.1, < 2",
34+
"grpcio-tools >=1.66.1, < 2",
35+
"protobuf >=5.28.2, < 6",
3636
"frequenz-client-base >= 0.8.0, < 0.9.0",
3737
]
3838
dynamic = ["version"]

src/frequenz/client/reporting/_client.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
MicrogridComponentIDs as PBMicrogridComponentIDs,
1717
)
1818
from frequenz.api.reporting.v1.reporting_pb2 import IncludeOptions as PBIncludeOptions
19+
from frequenz.api.reporting.v1.reporting_pb2 import (
20+
MetricConnections as PBMetricConnections,
21+
)
1922
from frequenz.api.reporting.v1.reporting_pb2 import (
2023
ReceiveMicrogridComponentsDataStreamRequest as PBReceiveMicrogridComponentsDataStreamRequest,
2124
)
@@ -65,6 +68,7 @@ def is_empty(self) -> bool:
6568
return True
6669
return False
6770

71+
# pylint: disable=too-many-locals
6872
def __iter__(self) -> Iterator[MetricSample]:
6973
"""Get generator that iterates over all values in the batch.
7074
@@ -317,11 +321,17 @@ def dt2ts(dt: datetime) -> PBTimestamp:
317321
include_options=include_options,
318322
)
319323

320-
metrics_pb = [metric.to_proto() for metric in metrics]
324+
metric_conns_pb = [
325+
PBMetricConnections(
326+
metric=metric.to_proto(),
327+
connections=[],
328+
)
329+
for metric in metrics
330+
]
321331

322332
request = PBReceiveMicrogridComponentsDataStreamRequest(
323333
microgrid_components=microgrid_components_pb,
324-
metrics=metrics_pb,
334+
metrics=metric_conns_pb,
325335
filter=stream_filter,
326336
)
327337

0 commit comments

Comments
 (0)