Ensure min interval on workers history charts so that we do not get "saw like" chart due to the missing points in the intervals

This commit is contained in:
allegroai 2024-06-20 17:43:52 +03:00
parent beff19e104
commit 0496582d96
2 changed files with 8 additions and 0 deletions

View File

@ -13,6 +13,8 @@ log = config.logger(__file__)
class WorkerStats:
min_chart_interval = config.get("services.workers.min_chart_interval_sec", 40)
def __init__(self, es):
self.es = es
@ -203,6 +205,7 @@ class WorkerStats:
"""
if from_date >= to_date:
raise bad_request.FieldsValueError("from_date must be less than to_date")
interval = max(interval, self.min_chart_interval)
must = [QueryBuilder.dates_range(from_date, to_date)]
if active_only:

View File

@ -0,0 +1,5 @@
default_worker_timeout_sec: 600
default_cluster_timeout_sec: 600
# The minimal sampling interval for resource dashboard and worker activity charts
min_chart_interval_sec: 40