Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
noc
noc
Commits
b13ba03e
Verified
Commit
b13ba03e
authored
Sep 18, 2022
by
Andrey Vertiprahov
Browse files
Fix detect UTC offset for metriccollector.
parent
bac371ed
Pipeline
#37579
passed with stages
in 27 minutes and 35 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
config.py
View file @
b13ba03e
...
...
@@ -1006,6 +1006,20 @@ class Config(BaseConfig):
# Check quantiles is enabled
return
getattr
(
self
.
perfomance
,
f
"enable_
{
name
}
_quantiles"
,
False
)
@
property
def
tz_utc_offset
(
self
)
->
int
:
"""
Return UTC offset for configured timezone
:return:
"""
import
pytz
import
datetime
if
not
hasattr
(
self
,
"_utcoffset"
):
dt
=
datetime
.
datetime
.
now
(
tz
=
pytz
.
utc
)
self
.
_utcoffset
=
dt
.
astimezone
(
self
.
timezone
).
utcoffset
()
return
int
(
self
.
_utcoffset
.
total_seconds
())
config
=
Config
()
config
.
load
()
...
...
services/metricscollector/service.py
View file @
b13ba03e
...
...
@@ -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
.
t
imezone
.
_utcoffset
.
seconds
)
*
NS
,
"ts"
:
(
item
.
ts
.
timestamp
()
+
config
.
t
z
_utc
_
offset
)
*
NS
,
"scope"
:
map_item
.
ch_table
,
"labels"
:
item
.
labels
,
"service"
:
item
.
service
,
...
...
Andrey Vertiprahov
@aversant
mentioned in commit
5a42d3ee
·
Sep 18, 2022
mentioned in commit
5a42d3ee
mentioned in commit 5a42d3ee1477305264d879c89a3223cc25a2488f
Toggle commit list
Andrey Vertiprahov
@aversant
mentioned in merge request
!6664 (merged)
·
Sep 18, 2022
mentioned in merge request
!6664 (merged)
mentioned in merge request !6664
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment