Skip to content

Commit af49069

Browse files
committed
Change type of single data samples to MetricSample
This removes the distinction between querying single and multiple metrics to simplify the code base. Signed-off-by: cwasicki <[email protected]>
1 parent 9b830c8 commit af49069

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/frequenz/client/reporting/_client.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131

3232
# pylint: enable=no-name-in-module
3333

34-
Sample = namedtuple("Sample", ["timestamp", "value"])
35-
"""Type for a sample of a time series."""
36-
3734
MetricSample = namedtuple(
3835
"MetricSample", ["timestamp", "microgrid_id", "component_id", "metric", "value"]
3936
)
@@ -129,7 +126,7 @@ async def iterate_single_metric(
129126
start_dt: datetime,
130127
end_dt: datetime,
131128
page_size: int = 1000,
132-
) -> AsyncIterator[Sample]:
129+
) -> AsyncIterator[MetricSample]:
133130
"""Iterate over the data for a single metric.
134131
135132
Args:
@@ -153,7 +150,7 @@ async def iterate_single_metric(
153150
page_size=page_size,
154151
):
155152
for entry in page.iterate_metric_samples():
156-
yield Sample(timestamp=entry.timestamp, value=entry.value)
153+
yield entry
157154

158155
# pylint: disable=too-many-arguments
159156
async def _iterate_components_data_pages(

0 commit comments

Comments
 (0)