Skip to content

Commit 2cf122b

Browse files
author
fer
committed
perf(telemetry): Use timezone-aware UTC timestamps (datetime.now(UTC)) replacing deprecated utcnow
1 parent 2e21dc2 commit 2cf122b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/tnfr/metrics/telemetry.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
from __future__ import annotations
5454

5555
from dataclasses import dataclass, asdict
56-
from datetime import datetime
56+
from datetime import datetime, UTC
5757
from pathlib import Path
5858
from typing import Any, Iterable, Mapping, MutableMapping
5959
import json
@@ -263,8 +263,9 @@ def _compute() -> None:
263263
else:
264264
_compute()
265265

266+
# Use timezone-aware UTC to avoid deprecation of datetime.utcnow()
266267
event = TelemetryEvent(
267-
t_iso=datetime.utcnow().isoformat(timespec="seconds") + "Z",
268+
t_iso=datetime.now(UTC).isoformat(timespec="seconds"),
268269
t_epoch=time.time(),
269270
step=step,
270271
operator=operator,

0 commit comments

Comments
 (0)