INNER CODE UNIT · Python

observe

VersusControl/versus-incident · scripts/generate_fake_metrics.py:111

    def observe(self, code: int, seconds: float) -> None:
        key = str(code)
        self.requests[key] = self.requests.get(key, 0) + 1
        for i, ub in enumerate(BUCKETS):
            if seconds <= ub:
                self.bucket_counts[i] += 1
        self.inf_count += 1
        self.duration_sum += seconds
        self.duration_count += 1


def simulate_tick(series: Series, spiking: bool, rate: int) -> None:
    """Fold ~one interval of synthetic traffic into the cumulative series.

    Normal: steady volume, ~0.5% errors, low latency (rules stay silent).
    Spike:  more volume, ~45% 500s, fat-tailed latency (p95 > 500ms) so the
            anomaly rules cross their thresholds.
    """

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…