- Build:
cargo build - Test all:
cargo nextest run - Test single:
cargo nextest run <test_name>orcargo nextest run --test <file> <test_name> - Clippy:
cargo clippy --all-targets -- -D warnings -D unreachable_pub -D clippy::await_holding_lock -D clippy::clone_on_ref_ptr - Format:
cargo fmt --all - Lint fix:
./scripts/lint-fix.sh - Feature check:
cargo hack check --feature-powerset --no-dev-deps --depth 1
- Rust 2021 edition, use
rustfmtdefaults - Imports: group std, external crates, then internal modules; use
crate::for internal imports - Types: prefer
Box<dyn Error + Send + Sync>for generic errors; useanyhow::Resultfor bootstrap errors - Naming: snake_case for functions/variables, PascalCase for types, SCREAMING_SNAKE for constants
- Errors: use
BootstrapResult<T>(anyhow) for initialization,Result<T>(boxed error) for runtime - Docs: add
///doc comments for public items;#![warn(missing_docs)]is enabled - Feature flags: wrap platform/optional code with
#[cfg(feature = "...")] - No
openssl/openssl-sys- useboring,ring, orrustlsinstead
UserSpan::deferred()creates a stable request root that can be captured by telemetry contexts beforeactivate()makes the sampling decision.TelemetryContext::with_user_span()attaches an explicitUserSpanwithout changing ambient scope; the returned context and handle share the same underlying span.- A deferred root is an inactive span in a shared
RwLock. Activation replaces it under the write lock; the first active span wins, while inactive results remain retryable. - Recording and children created before activation are inactive. Contexts that captured the root itself observe a later activation.
- A sampled span remains protected by the same non-poisoning
RwLockused by eager user spans. - User trace resources use
UserTracingSettings::service_nameand intentionally omit the internal service version. - Discarding a user span replaces it with an inactive one under the write lock, so every handle stops recording.
- User spans keep their sampled flag in a
UserSpanSlotshared by every handle, next to theRwLockbut outside it. Activation and discard update it under the write lock, so every handle reports the same state. Internal spans never change after creation, so the handle variant implies their flag, orTrackedstores it.