Merge "Cap maximum evaluation period and granularity"

This commit is contained in:
Zuul 2025-03-17 18:12:42 +00:00 committed by Gerrit Code Review
commit 022a2b6c84
2 changed files with 5 additions and 2 deletions

View File

@ -59,10 +59,12 @@ class AlarmGnocchiThresholdRule(base.AlarmRule):
aggregation_method = wsme.wsattr(wtypes.text, mandatory=True)
"The aggregation_method to compare to the threshold"
evaluation_periods = wsme.wsattr(wtypes.IntegerType(minimum=1), default=1)
evaluation_periods = wsme.wsattr(wtypes.IntegerType(
minimum=1, maximum=100), default=1)
"The number of historical periods to evaluate the threshold"
granularity = wsme.wsattr(wtypes.IntegerType(minimum=1), default=60)
granularity = wsme.wsattr(wtypes.IntegerType(
minimum=1, maximum=3600 * 24 * 365), default=60)
"The time range in seconds over which query"
cache = cachetools.TTLCache(maxsize=1, ttl=3600)

View File

@ -36,6 +36,7 @@ COMPARATORS = {
OPTS = [
cfg.IntOpt('additional_ingestion_lag',
min=0,
max=3600 * 24,
default=0,
help='The number of seconds to extend the evaluation windows '
'to compensate the reporting/ingestion lag.')