Skip to content

Commit

Permalink
Put fio local timezone data in UTC+0 timezone to es
Browse files Browse the repository at this point in the history
So that we only change grafana dashboard timezone to the local timezone,
and the timerange selection will always aligin the local timezone
  • Loading branch information
inevity committed Sep 8, 2021
1 parent 1c9e453 commit 36ed8fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions snafu/fio_wrapper/trigger_fio.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def _log_payload(self, directory, fio_starttime, job, fio_output_file): # pod_d
log_line_values = str(log_line).split(", ")
if len(log_line_values) == 5:
timestamp_ms = int(fio_starttime[host]) + int(log_line_values[0])
newtime = datetime.fromtimestamp(timestamp_ms / 1000.0)
newtime = datetime.utcfromtimestamp(timestamp_ms / 1000.0)
log_dict = {
"uuid": self.uuid,
"user": self.user,
Expand Down Expand Up @@ -198,7 +198,7 @@ def _histogram_payload(
if len(log_line_values) == 7 and not (any(len(str(x)) <= 0 for x in log_line_values)):
logger.debug(log_line_values)
timestamp_ms = int(longest_fio_startime) + int(log_line_values[0])
newtime = datetime.fromtimestamp(timestamp_ms / 1000.0)
newtime = datetime.utcfromtimestamp(timestamp_ms / 1000.0)
log_dict = {
"uuid": self.uuid,
"user": self.user,
Expand Down
4 changes: 2 additions & 2 deletions snafu/log_generator_wrapper/trigger_log_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ def _check_es(self, start_time, end_time):
header_json = "Content-Type: application/json"
if self.es_token:
header_auth = "Authorization: Bearer " + self.es_token
s_time = datetime.datetime.fromtimestamp(start_time - 60).strftime("%Y-%m-%dT%H:%M:%S")
e_time = datetime.datetime.fromtimestamp(end_time + 60).strftime("%Y-%m-%dT%H:%M:%S")
s_time = datetime.datetime.utcfromtimestamp(start_time - 60).strftime("%Y-%m-%dT%H:%M:%S")
e_time = datetime.datetime.utcfromtimestamp(end_time + 60).strftime("%Y-%m-%dT%H:%M:%S")
data = {
"query": {
"bool": {
Expand Down

0 comments on commit 36ed8fd

Please sign in to comment.