Repository navigation
fix: make HybridCache::disable_tracing disable tracing - #14
Closed
detail-app[bot] wants to merge 1 commit into
Closed
detail-app[bot] wants to merge 1 commit into
detail-app[bot] wants to merge 1 commit into
Conversation
Author
|
Closing this pull request because it has had no human activity in 30 days (since 2026-09-11) and was opened 30 days ago. Detail closes its pull requests once they are more than 30 days old and have had no human activity for 14 days. If this change is still useful, reopen the pull request and Detail won't close it again. To keep a Detail pull request open, add the |
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.
Detail bug report: View on Detail
Bug
HybridCache::disable_tracing()storedtrueinto the internalAtomicBool(Inner::tracing) instead offalse— an apparent copy-paste fromenable_tracing()directly above it, introduced in PR foyer-rs#574 and preserved through subsequent refactors. The flag is read without inversion (root_span!creates a realSpan::rootwhentrue, elseSpan::noop();is_tracing_enabled()returns the raw bool), sodisable_tracing()actually enabled tracing andis_tracing_enabled()reportedtrueright after.false, so only callers ofdisable_tracing()are affected.fastrace/enableadditionally on and a reporter installed, tracedinsert/get/… operations afterdisable_tracing()still export spans.disable_tracingpath had zero test coverage anywhere in the repo, which is why the typo persisted.Fix
In
foyer/src/hybrid/cache.rs, changeddisable_tracing()tostore(false, …). Minimal and idiomatic: the flag's documented semantics aretrue = tracing on, so disabling must storefalse, mirroringenable_tracing()'s symmetricstore(true).Testing
Two regression tests added to
mod tests(both#[cfg(feature = "tracing")]):test_disable_tracing_flag_level— asserts the publicis_tracing_enabled()contract (default-off →enable→ on →disable→ off → repeatable toggling). Meaningful with just--features tracing.test_disable_tracing_end_to_end_emits_no_spans— installs an in-process fastrace reporter, traces aninsertwith tracing on (positive control), then callsdisable_tracing()and asserts no newinsertspans are exported, then re-enables and asserts new spans appear. Self-calibrates: withoutfastrace/enable(thetracingfeature deliberately doesn't enable it)Span::rootcollapses toSpan::noop(), so the test exits as a no-op rather than failing on an inert reporter pipeline.Checks run:
--features tracing(flag-level) and--features 'tracing,fastrace/enable'(end-to-end, span path genuinely exercised).hybrid::cache::testsmodule: 13/13 pass withtracing,fastrace/enable; 11/11 pass with tracing off (new tests correctly absent). The fuzzy integration test (test_utils) passes (1/1).cargo fmt --all -- --check,cargo clippy -p foyer --features tracing --all-targets -- -D warnings, andcargo check -p foyer(default and--features tracing). The only clippy diagnostic is a pre-existing workspaceunknown_lintsnote unrelated to this change.Non-versioned verification:
disable_tracing()tostore(true, …)makes both new tests fail — the flag-level test with "disable_tracing() must report tracing disabled", and the end-to-end test with exportedinsertspan records whose names includefoyer::hybrid::cache::insertand thefoyer::memory::*::insertchildren (the exact symptom reported). Restoring the fix makes both pass.cargo run --features 'tracing,otel' --example tail_based_tracingbuilds and runs to completion (exit 0) —enable_tracing()+insert+getsucceed without panic. Caveat: no live OTLP collector was running on the hard-coded endpoint127.0.0.1:4317, so actual span delivery to a collector was not verified; the program returnsOk(())regardless since export is non-fatal. The span-suppression contract itself is fully covered by the in-process reporter test above, which needs no external collector.Automatic Fixes PRs can be configured here.