Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
## Upgrading

* Update repo-config and setuptools versions
* Timestamps in the response are now timezone aware.

## New Features

Expand Down
5 changes: 4 additions & 1 deletion src/frequenz/client/reporting/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from collections import namedtuple
from collections.abc import AsyncIterator, Iterable, Iterator
from dataclasses import dataclass
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from typing import cast

import grpc.aio as grpcaio
Expand Down Expand Up @@ -90,6 +90,9 @@ def __iter__(self) -> Iterator[MetricSample]:
cid = cdata.component_id
for msample in cdata.metric_samples:
ts = msample.sampled_at.ToDatetime()
# Ensure tz-aware timestamps,
# as the API returns tz-naive UTC timestamps
ts = ts.replace(tzinfo=timezone.utc)
met = Metric.from_proto(msample.metric).name
value = (
msample.value.simple_metric.value
Expand Down
Loading