feat(telemetry): classify every scan's cache temperature in the wide event#1059
Merged
Conversation
…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>
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 explicitwholeRepoCacheHitflag 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 withREACT_DOCTOR_NO_CACHEset (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), andratioOfde-duplicates the two pre-existing inline ratio computations.CachedScanPayload, no schema bump, no new counters (wide-event home per repo conventions).Test plan
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).cache.temperaturefor the adoption mix;p50(timing.elapsedMs)per temperature for the latency payoff (nottiming.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
renderAndRecordScancall 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.temperatureisturbo(whole-repo scan-result replay),warm(any incremental reuse),cold(caches on, zero reuse), ordisabledwhenREACT_DOCTOR_NO_CACHEis set.cache.warmthis the unweighted mean of known subsystem reuse fractions (lint, sidecar, dead-code);1on turbo.cache.wholeRepoHitmirrors the new explicit flag. Existinglint.*/deadCode.*cache dims are unchanged; lint/sidecar ratios now go through a sharedratioOfhelper.Wiring:
inspectpasseswholeRepoCacheHit: trueon the cached-payload branch andfalseon fresh scans soturbois never guessed from missing subsystem stats.isCacheGloballyDisabledis exported fromscan-result-cachefor the disabled-vs-cold distinction.Tests: Eight new cases in
build-run-event.test.tscover 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.