AIOps Observer
← All labs

Anomaly detection / Intermediate / 25–40 min

The anomaly detector trained on an incident

A trained anomaly detector treats incident-like latency as normal. Investigate contamination in the training window and restore detection.

LAB IDaiops-02-contaminated-baselineTRACK / aiops.observer
Analyst monitoring system signals beside AI server hardware

The scenario

An Isolation Forest is fitted on historical synthetic latency data. A known incident window was included in the baseline, and a new incident-like reading is classified as normal. Correct the training selection while retaining the healthy baseline.

Mission objectives

  • Reproduce the missed alert and inspect the labeled training window.
  • Exclude the known incident period without changing the model or source data.
  • Check held-out healthy and incident-like observations after retraining.

Lab README

The anomaly detector trained on an incident

The anomaly detector classifies an incident-like latency as normal. Investigate the training window and correct the baseline selection, rather than suppressing alerts or changing the observations.

Before you begin

Use Bash and Python 3.11 or later in a disposable local environment. Create a virtual environment and install the pinned model library:

LAB_VENV="$(mktemp -d)"
python3 -m venv "$LAB_VENV"
. "$LAB_VENV/bin/activate"
python -m pip install -r requirements.txt

Installing packages needs internet access. This exercise trains a real scikit-learn Isolation Forest on synthetic one-dimensional latency values. It does not contact an external AI service or consume real operational data.

Investigate

./setup.sh
cat baseline.csv
cat training-policy.json
python detector.py 225

Rows labeled incident belong to a known incident window; rows labeled healthy belong to the approved baseline. The labels are supplied incident records, not predictions made by the model. Change the training selection in training-policy.json while retaining the original dataset and detector. Each invocation trains a fresh deterministic model, so rerun the command after changing the policy.

./verify.sh
./teardown.sh

Verification checks the original dataset and policy and exercises healthy and incident-like observations that were not in the training data. The fixed synthetic scenario demonstrates contamination, not a production-ready alert: real baselines need representative data, validated labels, drift monitoring and evaluation before deployment. Teardown has no service or cloud resources to remove; deactivate and remove the temporary virtual environment separately when done.

View Markdown source ↗

Get the lab

Download and inspect the installer before running it. It checks the archive's SHA-256 digest and refuses to overwrite an existing lab directory.

curl -fsSLO https://devops.download/labs/aiops-02-contaminated-baseline.sh
less aiops-02-contaminated-baseline.sh
bash aiops-02-contaminated-baseline.sh
cd labs/aiops-02-contaminated-baseline
./setup.sh

When you've made your changes, run ./verify.sh. Remove lab resources with ./teardown.sh.

Download the archive instead ↗

Need a nudge?

Hint #1

Compare the operational labels and latency distributions in baseline.csv.

Hint #2

Inspect training-policy.json and rerun the analysis after selecting only the known healthy baseline.

Hint #3 · Learning paths on opsbreakfix.com

Explore learning paths ↗

Solved it?

Continue learning with the paths on opsbreakfix.com.

Continue to opsbreakfix.com ↗

One ecosystem.
Many perspectives.

Follow the connection from a hands-on lab to the knowledge and tools behind it.