AutoRollbackMonitor
AutoRollbackMonitor(config: MetricDropAutoRollbackConfiguration) -> NoneMonitors a metric over time and determines when an automatic rollback should be triggered.
Tracks (step, value) pairs and compares the value at the start of the lookback window with the value at the end. If the metric has dropped by more than the configured threshold, a rollback is triggered.
Initialize the AutoRollbackMonitor.
Parameters:
config(MetricDropAutoRollbackConfiguration) – The metric drop automatic rollback configuration.
Properties
metric
metric: strGet the metric tag prefix being monitored.
Returns:
str– The metric tag prefix string.
period_steps
period_steps: intGet the number of actor steps over which the drop is measured.
Returns:
int– The period in actor steps.
rollback_steps
rollback_steps: intGet the effective number of steps to roll back by.
Returns:
int– The rollback steps (defaults toperiod_stepsif not explicitly set).
Methods
mark_rolled_back
mark_rolled_back(step: int) -> NoneMark that a rollback occurred at the given step, resetting the monitor's history.
Parameters:
step(int) – The actor step at which the rollback happened.
record
record(step: int, value: float) -> NoneRecord a metric observation at a given actor step.
Parameters:
step(int) – The actor step at which the value was observed.value(float) – The metric value.
reset
reset() -> NoneReset the monitor's history completely.
should_rollback
should_rollback() -> boolCheck if the metric has dropped enough to warrant a rollback.
Compares the value at the start of the lookback window with the current value. If the metric has dropped by more than the configured threshold, a rollback is triggered.
Returns:
bool– True if the current metric value has dropped from the start of the lookback window by more than the configured threshold.