timing.tracker

Attributes

AnomalyCallback

Classes

StepTimingTracker

Singleton tracker that persists step runtimes and reports anomalies.

Module Contents

timing.tracker.AnomalyCallback
class timing.tracker.StepTimingTracker(config: timing.config.TimingConfig | None = None)

Bases: raccoon.class_name_logger.ClassNameLogger

Singleton tracker that persists step runtimes and reports anomalies.

config
database
anomaly_callbacks: List[AnomalyCallback] = []
classmethod get_instance() StepTimingTracker

Return the process-wide tracker instance used by Step.run_step.

configure(config: timing.config.TimingConfig) None

Replace configuration at runtime.

register_anomaly_callback(callback: AnomalyCallback) None

Register an async callback to run when an anomaly is detected.

async record_execution(signature: str, duration: float) timing.models.AnomalyDetection | None

Persist execution and evaluate for anomalies.

Returns:

The detected anomaly, or None if the execution was normal.

async get_upper_bound(signature: str) float | None

Return the anomaly upper bound for a signature, or None if no baseline.

This is the duration above which an execution would be flagged as SLOWER than expected. Used by the live watchdog in Step.run_step.