Commit 12a05900 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'fix-avs-detect-utc-offset' into 'master'

Fix detect UTC offset for metriccollector.

See merge request noc/noc!6663
parents bac371ed b13ba03e
Pipeline #37584 passed with stage
in 7 minutes and 47 seconds
......@@ -1006,6 +1006,20 @@ class Config(BaseConfig):
# Check quantiles is enabled
return getattr(self.perfomance, f"enable_{name}_quantiles", False)
def tz_utc_offset(self) -> int:
Return UTC offset for configured timezone
import pytz
import datetime
if not hasattr(self, "_utcoffset"):
dt =
self._utcoffset = dt.astimezone(self.timezone).utcoffset()
return int(self._utcoffset.total_seconds())
config = Config()
......@@ -189,7 +189,7 @@ class MetricsCollectorService(FastAPIService):
# Matched rule found
if map_item.ch_table not in out:
out[map_item.ch_table] = {
"ts": (item.ts.timestamp() + config.timezone._utcoffset.seconds) * NS,
"ts": (item.ts.timestamp() + config.tz_utc_offset) * NS,
"scope": map_item.ch_table,
"labels": item.labels,
"service": item.service,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment