Skip to content

Commit

Permalink
Adding overlap between collection intervals (#760)
Browse files Browse the repository at this point in the history
* Adding overlap between collection intervals

* resolving conflicts

Co-authored-by: sushanth <[email protected]>
  • Loading branch information
NajmudheenCT and sushanthakumar authored Oct 20, 2021
1 parent 116a391 commit cfd3f3e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions delfin/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@
.DEF_PERFORMANCE_HISTORY_ON_RESCHEDULE,
help='default history(in sec) to be collected on a job '
'reschedule'),
cfg.IntOpt('performance_timestamp_overlap',
default=constants.TelemetryCollection
.DEF_PERFORMANCE_TIMESTAMP_OVERLAP,
help='default overlap to be added on start_time in sec '
),
cfg.IntOpt('max_failed_task_retry_window',
default=constants.TelemetryCollection
.MAX_FAILED_TASK_RETRY_WINDOW,
Expand Down
1 change: 1 addition & 0 deletions delfin/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ class TelemetryCollection(object):
"""Default performance collection interval"""
DEF_PERFORMANCE_COLLECTION_INTERVAL = 900
DEF_PERFORMANCE_HISTORY_ON_RESCHEDULE = 1800
DEF_PERFORMANCE_TIMESTAMP_OVERLAP = 60
"""Maximum failed task retry window in seconds"""
MAX_FAILED_TASK_RETRY_WINDOW = 7200

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

import six
from oslo_config import cfg


from oslo_log import log

from delfin import db
Expand All @@ -30,6 +32,7 @@
FailedPerformanceCollectionHandler
from delfin.task_manager.tasks.telemetry import PerformanceCollectionTask

CONF = cfg.CONF
LOG = log.getLogger(__name__)
CONF = cfg.CONF

Expand Down Expand Up @@ -78,8 +81,10 @@ def __call__(self):
current_time = int(datetime.now().timestamp())

# Times are epoch time in milliseconds
overlap = CONF.telemetry. \
performance_timestamp_overlap
end_time = current_time * 1000
start_time = end_time - (self.interval * 1000)
start_time = end_time - (self.interval * 1000) - (overlap * 1000)
telemetry = PerformanceCollectionTask()
status = telemetry.collect(self.ctx, self.storage_id, self.args,
start_time, end_time)
Expand Down

0 comments on commit cfd3f3e

Please sign in to comment.