Compare a current resource reading with a fixed baseline and label the drift.

drift signal Resource drift is the difference between a current reading and a stable baseline.

Resource Drift Report

current
resource_drift.js
Replay: real traced execution (multi-file project)
const current = 112;
const baseline = 100;
const drift = current - baseline;
let driftStatus = "normal";

if (drift >= 25) {
    driftStatus = "high";
} else if (drift >= 8) {
    driftStatus = "elevated";
}

console.log(`current=${current} drift=${drift} status=${driftStatus}`);
const current = 103;
const baseline = 100;
const drift = current - baseline;
let driftStatus = "normal";

if (drift >= 25) {
    driftStatus = "high";
} else if (drift >= 8) {
    driftStatus = "elevated";
}

console.log(`current=${current} drift=${drift} status=${driftStatus}`);
const current = 130;
const baseline = 100;
const drift = current - baseline;
let driftStatus = "normal";

if (drift >= 25) {
    driftStatus = "high";
} else if (drift >= 8) {
    driftStatus = "elevated";
}

console.log(`current=${current} drift=${drift} status=${driftStatus}`);
  1. current ← 112, baseline ← 100, drift ← 12, driftStatus ← normal

    1const current→ 112 = 112;  //@current=103, 1302const baseline→ 100 = 100;3const drift→ 12 = current→ 112 - baseline100;4let driftStatus→ normal = "normal";
  2. if (drift >= 8)

    7    driftStatus = "high";8} else if (drift12 >= 8) {9    driftStatus = "elevated";10}
  3. console.log(`current=${current} drift=${drift} status=${driftStatus}`)…

    9    driftStatus = "elevated";10}1112console.log(`current=${current112} drift=${drift12} status=${driftStatuselevated}`);
    outputcurrent=112 drift=12 status=elevated
  1. current ← 103, baseline ← 100, drift ← 3, driftStatus ← normal

    1const current→ 103 = 103;2const baseline→ 100 = 100;3const drift→ 3 = current→ 103 - baseline100;4let driftStatus→ normal = "normal";56if (drift >= 25) {7    driftStatus = "high";8} else if (drift >= 8) {9    driftStatus = "elevated";10}1112console.log(`current=${current103} drift=${drift3} status=${driftStatusnormal}`);
    outputcurrent=103 drift=3 status=normal
  1. current ← 130, baseline ← 100, drift ← 30, driftStatus ← normal

    1const current→ 130 = 130;2const baseline→ 100 = 100;3const drift→ 30 = current→ 130 - baseline100;4let driftStatus→ normal = "normal";
  2. if (drift >= 25)

    3const drift = current - baseline;4let driftStatus = "normal";56if (drift30 >= 25) {7    driftStatus = "high";8} else if (drift >= 8) {
  3. console.log(`current=${current} drift=${drift} status=${driftStatus}`)…

    9    driftStatus = "elevated";10}1112console.log(`current=${current130} drift=${drift30} status=${driftStatushigh}`);
    outputcurrent=130 drift=30 status=high