Skip to content

feat(telemetry): classify every scan's cache temperature in the wide event#1059

Merged
rayhanadev merged 1 commit into
mainfrom
ray/perf-cache-temperature-telemetry
Jul 4, 2026
Merged

feat(telemetry): classify every scan's cache temperature in the wide event#1059
rayhanadev merged 1 commit into
mainfrom
ray/perf-cache-temperature-telemetry

Conversation

@rayhanadev

@rayhanadev rayhanadev commented Jul 4, 2026

Copy link
Copy Markdown
Member

Why

The cache stack now has five layers, each with its own telemetry dim — but no single queryable answer to "was this run cold, incremental, or a full replay, and how warm was it?" This adds that classification so Sentry can segment scan latency by cache temperature and watch the incremental caches' real-world hit rates.

What changed

  • cache.temperature (string dim): "turbo" — whole-repo payload replay, driven by an explicit wholeRepoCacheHit flag passed from the cachedPayload branch (never inferred from nulls); "warm" — any incremental reuse (lint cache hits, sidecar replays, dead-code result hit, or summary hits); "disabled" — zero reuse with REACT_DOCTOR_NO_CACHE set (reuses the cache modules' own global-disable check, so it can never mislabel a real hit); "cold" — caches on, zero reuse.
  • cache.warmth (number 0–1): unweighted mean of the available subsystem reuse fractions (lint hit ratio, sidecar replay ratio, dead-code: 1 for a whole-result hit else summary hit fraction), skipping null subsystems; 1 on turbo; dropped when nothing consulted a cache. The per-subsystem dims remain the precise drill-down.
  • cache.wholeRepoHit (boolean dim), and ratioOf de-duplicates the two pre-existing inline ratio computations.
  • Nothing added to CachedScanPayload, no schema bump, no new counters (wide-event home per repo conventions).

Test plan

  • +8 derivation-matrix tests (turbo / cold / disabled with both env spellings / warm via each subsystem individually / warmth mean-with-null-skipping arithmetic / consulted-miss-as-zero / legacy shape / failure path): react-doctor 2151 passed / 26 skipped. Root typecheck + lint clean.
  • Functional proof captured on the wire via a local Sentry envelope receiver (post-scrubSentryEvent, confirming the new fields survive scrubbing): cold → (cold, 0); warm after one new file → (warm, 0.9989 = mean(619/620, 619/619, 619/620)); unchanged rerun → (turbo, 1) at 85ms; REACT_DOCTOR_NO_CACHE=1(disabled, absent).
  • Query recipe: Trace Explorer / Spans — group by cache.temperature for the adoption mix; p50(timing.elapsedMs) per temperature for the latency payoff (not timing.scanMs, which turbo replays from the payload); p90(cache.warmth) filtered to warm for reuse depth.

🤖 Generated with Claude Code


Note

Low Risk
Telemetry-only changes to span attributes and explicit flags at existing renderAndRecordScan call sites; scan behavior and cache storage are unchanged.

Overview
Adds cache-temperature telemetry to the per-scan Sentry wide event so adoption and latency can be segmented without inferring from scattered lint/dead-code cache dims.

cache.* on the success path: cache.temperature is turbo (whole-repo scan-result replay), warm (any incremental reuse), cold (caches on, zero reuse), or disabled when REACT_DOCTOR_NO_CACHE is set. cache.warmth is the unweighted mean of known subsystem reuse fractions (lint, sidecar, dead-code); 1 on turbo. cache.wholeRepoHit mirrors the new explicit flag. Existing lint.* / deadCode.* cache dims are unchanged; lint/sidecar ratios now go through a shared ratioOf helper.

Wiring: inspect passes wholeRepoCacheHit: true on the cached-payload branch and false on fresh scans so turbo is never guessed from missing subsystem stats. isCacheGloballyDisabled is exported from scan-result-cache for the disabled-vs-cold distinction.

Tests: Eight new cases in build-run-event.test.ts cover the derivation matrix and failure-path omission. Telemetry-only — no cache schema or report changes.

Reviewed by Cursor Bugbot for commit 9037a34. Bugbot is set up for automated code reviews on this repo. Configure here.

…event

cache.temperature (turbo from an explicit whole-repo-hit flag, warm on any
incremental reuse, cold, disabled) plus cache.warmth (mean of subsystem
reuse ratios) make cold vs incremental vs full-replay runs queryable in
Sentry alongside the per-subsystem drill-down dims.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 4, 2026 05:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@pkg-pr-new

pkg-pr-new Bot commented Jul 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-react-doctor@1059
npm i https://pkg.pr.new/oxlint-plugin-react-doctor@1059
npm i https://pkg.pr.new/react-doctor@1059

commit: 9037a34

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@rayhanadev rayhanadev merged commit bdf8074 into main Jul 4, 2026
26 of 29 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants